Performs a monoidal analysis over this free program.
Performs a monoidal analysis over this free program. Maps the
effects in F
to values in the monoid M
, discarding the values
of those effects.
Example:
def count[F[_],B](p: FreeAp[F,B]): Int = p.analyze(new (F ~> λ[α => Int]) { def apply[A](a: F[A]) = 1 })
Idiomatic function application
The canonical natural transformation that interprets this free
program by giving it the semantics of the applicative functor G
.
The canonical natural transformation that interprets this free
program by giving it the semantics of the applicative functor G
.
Not tail-recursive unless G
is a free monad.
The natural transformation from FreeAp[F,_]
to FreeAp[G,_]
Append a function to the end of this program
Embeds this program in the free monad on F
.
Provides access to the first instruction of this program, if present
Interprets this free F
program using the semantics of the
Applicative
instance for F
.
Free applicative functors. Less expressive than free monads, but more flexible to inspect and interpret.