arrow-core-data / arrow.typeclasses / Alternative
interface ~~Alternative~~<F> :
Applicative
<F>,
MonoidK
<F>
Deprecated: Higher Kinded types and their related type classes will no longer be supported after Arrow 0.13.0. Most relevant APIs are now concrete over the data types available as members or top level extension functions
The Alternative type class is for Applicative functors which also have a monoid structure.
alt | Combines two computations. Infix alias over orElse.open infix fun <A> Kind<F, A>.alt(b: Kind<F, A>): Kind<F, A> |
combineK | Combine two F values.open fun <A> Kind<F, A>.combineK(y: Kind<F, A>): Kind<F, A> |
guard | open fun guard(b: Boolean ): Kind<F, Unit > |
lazyOrElse | Lazy or else, useful when traversing a structure with asum which short circuits on success. In general this should be implemented for every Alternative that models success and failure.open fun <A> Kind<F, A>.lazyOrElse(b: () -> Kind<F, A>): Kind<F, A> |
many | Repeats the computation until it fails. Does not requires it to succeed.open fun <A> Kind<F, A>.many(): Kind<F, SequenceK <A>> |
optional | Wraps the result in an optional. This never fails.open fun <A> Kind<F, A>.optional(): Kind<F, Option <A>> |
orElse | Combines two computations.abstract fun <A> Kind<F, A>.orElse(b: Kind<F, A>): Kind<F, A> |
some | Repeats the computation until it fails. Requires it to succeed at least once.open fun <A> Kind<F, A>.some(): Kind<F, SequenceK <A>> |
MonadCombine | interface ~~MonadCombine~~<F> : MonadFilter <F>, Alternative <F> |
MonadPlus | MonadPlus is a typeclass that extends a Monad by supporting choice and failure. It is equal to Alternative in its api, but provides additional laws for how flatMap and empty interact.interface ~~MonadPlus~~<F> : Monad <F>, Alternative <F> |
Do you like Arrow?
✖