arrow-core-data / arrow.typeclasses / Comonad


interface Comonad<F> : Functor<F>

The dual of monads, used to extract values from F


fx Entry point for monad bindings which enables for comprehension. The underlying implementation is based on coroutines. A coroutine is initiated and suspended inside MonadThrowContinuation yielding to Monad.flatMap. Once all the flatMap binds are completed the underlying monad is returned from the act of executing the coroutineopen val fx: ComonadFx<F>


coflatMap abstract fun <A, B> Kind<F, A>.coflatMap(f: (Kind<F, A>) -> B): Kind<F, B>
duplicate open fun <A> Kind<F, A>.duplicate(): Kind<F, Kind<F, A>>
extract abstract fun <A> Kind<F, A>.extract(): A

Extension Functions

cobinding fun <F, B : Any> Comonad<F>.~~cobinding~~(c: suspend ComonadSyntax<F>.() -> B): B


Bimonad interface Bimonad<F> : Monad<F>, Comonad<F>
ComonadContinuation open class ComonadContinuation<F, A : Any> : Serializable, Continuation<A>, Comonad<F>, ComonadSyntax<F>
ComonadSyntax interface ComonadSyntax<F> : Comonad<F>

Type Class Hierarchy

Do you like Arrow?

Arrow Org