arrow-mtl / arrow.mtl.typeclasses / MonadCombine

MonadCombine

interface MonadCombine<F> : MonadFilter<F>, Alternative<F>

Functions

separate open fun <G, A, B> Kind<F, Kind2<G, A, B>>.separate(BFG: Bifoldable<G>): Tuple2<Kind<F, A>, Kind<F, B>>
unite open fun <G, A> Kind<F, Kind<G, A>>.unite(FG: Foldable<G>): Kind<F, A>

Inherited Functions

bindingFilter open fun <B> bindingFilter(c: suspend MonadFilterContinuation<F, *>.() -> B): Kind<F, B>
Entry point for monad bindings which enables for comprehension. The underlying impl is based on coroutines. A coroutine is initiated and inside MonadContinuation suspended yielding to flatMap. Once all the flatMap binds are completed the underlying monad is returned from the act of executing the coroutine
empty abstract fun <A> empty(): Kind<F, A>
mapFilter open fun <A, B> Kind<F, A>.mapFilter(f: (A) -> Option<B>): Kind<F, B>
A combined map and filter. Filtering is handled via Option instead of Boolean such that the output type B can be different than the input type A.

Inheritors

ListKMonadCombine interface ListKMonadCombine : MonadCombine<ForListK>
OptionMonadCombine interface OptionMonadCombine : MonadCombine<ForOption>
SequenceKMonadCombine interface SequenceKMonadCombine : MonadCombine<ForSequenceK>
StateTMonadCombine interface StateTMonadCombine<F, S> : MonadCombine<StateTPartialOf<F, S>>, StateTMonad<F, S>, StateTSemigroupK<F, S>

Type Class Hierarchy