Portability | GADTs, Rank2Types |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | None |
Applicative
functors for free
Documentation
Compared to the free monad, they are less expressive. However, they are also more flexible to inspect and interpret, as the number of ways in which the values can be nested is more limited.
See Free Applicative Functors, by Paolo Capriotti and Ambrus Kaposi, for some applications.
The free Applicative
for a Functor
f
.
runAp :: Applicative g => (forall x. f x -> g x) -> Ap f a -> g aSource
Given a natural transformation from f
to g
, this gives a canonical monoidal natural transformation from
to Ap
fg
.
runAp t == retractApp . hoistApp t