category-extras-0.2: Various modules and constructs inspired by category theory.Source codeContentsIndex
Control.Monad.Free
Portabilitynon-portable (rank-2 types)
Stabilityexperimental
Maintainerdan.doel@gmail.com
Description
An implementation of the free monad of a functor, used in (at the least) futumorphisms and chronomorphisms in Control.Recursion
Synopsis
data Free f a
inFree :: f (Free f a) -> Free f a
cataFree :: Functor f => (a -> b) -> (f b -> b) -> Free f a -> b
distribFree :: (Functor f, Functor h) => (forall a. h (f a) -> f (h a)) -> forall a. Free h (f a) -> f (Free h a)
Documentation
data Free f a Source

The free monad of a functor f, formally,

 Free F A = mu X. A + FX
show/hide Instances
inFree :: f (Free f a) -> Free f aSource
cataFree :: Functor f => (a -> b) -> (f b -> b) -> Free f a -> bSource
The catamorphism for the free monad
distribFree :: (Functor f, Functor h) => (forall a. h (f a) -> f (h a)) -> forall a. Free h (f a) -> f (Free h a)Source
Lifts a distributive law of h over f to a distributive law of Free h over f
Produced by Haddock version 2.3.0