kernel
object kernel
Fundamental recursion schemes implemented in terms of functions and nothing else.
Value members
Concrete methods
Build a hylomorphism by recursively unfolding with coalgebra
and
refolding with algebra
.
Build a hylomorphism by recursively unfolding with coalgebra
and
refolding with algebra
.
hylo A ---------------> B | ^ co- | | algebra | | algebra | | v | F[A] ------------> F[B] map hylo
@inline
def hyloC[F[_] : Functor, G[_] : Functor, A, B](algebra: F[G[B]] => B, coalgebra: A => F[G[A]]): A => B
Convenience to build a hylomorphism for the composed functor F[G[_]]
.
Convenience to build a hylomorphism for the composed functor F[G[_]]
.
This is strictly for convenience and just delegates to hylo
with the
types set properly.
def hyloM[M[_] : Monad, F[_] : Traverse, A, B](algebra: F[B] => M[B], coalgebra: A => M[F[A]]): A => M[B]
Build a monadic hylomorphism
Build a monadic hylomorphism
hyloM A ---------------> M[B] | ^ co- | | algebraM | | flatMap f | | v | M[F[A]] ---------> M[F[M[B]]] map hyloM with f: F[M[B]] -----> M[F[B]] ----------> M[B] sequence flatMap algebraM
def hyloMC[M[_] : Monad, F[_] : Traverse, G[_] : Traverse, A, B](algebra: F[G[B]] => M[B], coalgebra: A => M[F[G[A]]]): A => M[B]
Convenience to build a monadic hylomorphism for the composed functor
F[G[_]]
.
Convenience to build a monadic hylomorphism for the composed functor
F[G[_]]
.