MonadValueExt

class Object
trait Matchable
class Any

Extensions

Extensions

extension [F[_], A](fa: F[A])
def repeatWhileM[G[_]](condition: A => Boolean)(using F: Monad[F], G: Alternative[G]): F[G[A]]

Execute an action repeatedly until its result fails to satisfy the given predicate, returning all the results obtained by sequential execution of fas.

Execute an action repeatedly until its result fails to satisfy the given predicate, returning all the results obtained by sequential execution of fas.

This implementation uses append on each evaluation result, so avoid data structures with non-constant append performance, e.g. List.