A free monad for a type constructor S
.
Binding is done using the heap instead of the stack, allowing tail-call elimination.
- Companion
- object
Value members
Concrete methods
Runs a single step, using a function that extracts the resumption from its suspension functor.
Runs a single step, using a function that extracts the resumption from its suspension functor.
Runs a Source
all the way to the end, tail-recursively, collecting the produced values.
Runs a Source
all the way to the end, tail-recursively, collecting the produced values.
Duplication in Free
as a comonad in the endofunctor category.
Duplication in Free
as a comonad in the endofunctor category.
Extension in Free
as a comonad in the endofunctor category.
Extension in Free
as a comonad in the endofunctor category.
Extraction from Free
as a comonad in the endofunctor category.
Extraction from Free
as a comonad in the endofunctor category.
Binds the given continuation to the result of this computation.
Binds the given continuation to the result of this computation.
Substitutes a free monad over the given functor into the suspension functor of this program.
Free
is a monad in an endofunctor category and this is its monadic bind.
Substitutes a free monad over the given functor into the suspension functor of this program.
Free
is a monad in an endofunctor category and this is its monadic bind.
Catamorphism. Run the first given function if Return, otherwise, the second given function.
Catamorphism. Run the first given function if Return, otherwise, the second given function.
Catamorphism for Free
.
Runs to completion, mapping the suspension with the given transformation at each step and
accumulating into the monad M
.
Catamorphism for Free
.
Runs to completion, mapping the suspension with the given transformation at each step and
accumulating into the monad M
.
Folds this free recursion to the right using the given natural transformations.
Folds this free recursion to the right using the given natural transformations.
Runs to completion, allowing the resumption function to thread an arbitrary state of type B
.
Runs to completion, allowing the resumption function to thread an arbitrary state of type B
.
Variant of foldRun
that allows to interleave effect M
at each step.
Variant of foldRun
that allows to interleave effect M
at each step.
Runs to completion, using a function that extracts the resumption from its suspension functor.
Runs to completion, using a function that extracts the resumption from its suspension functor.
Modifies the first suspension with the given natural transformation.
Modifies the first suspension with the given natural transformation.
Changes the suspension functor by the given natural transformation.
Changes the suspension functor by the given natural transformation.
Runs a trampoline all the way to the end, tail-recursively.
Runs a trampoline all the way to the end, tail-recursively.
Runs to completion, using a function that maps the resumption from S
to a monad M
.
Runs to completion, using a function that maps the resumption from S
to a monad M
.
- Since
7.0.1
Evaluate one layer in the free monad, re-associating any left-nested binds to the right and pulling the first suspension to the top.
Evaluate one layer in the free monad, re-associating any left-nested binds to the right and pulling the first suspension to the top.
Applies a function in a comonad to the corresponding value in this monad, annihilating both.
Applies a function in a comonad to the corresponding value in this monad, annihilating both.