Annotations-0.2: Constructing, analyzing and destructing annotated trees

Safe HaskellSafe-Infered

Annotations.F.Fixpoints

Contents

Synopsis

Fixed points of functors

newtype Fix fT Source

Fixpoint of functors.

Constructors

In 

Fields

out :: fT (Fix fT)
 

Instances

Eq (f (Fix f)) => Eq (Fix f) 
Show (f (Fix f)) => Show (Fix f) 

compos :: Functor f => (Fix f -> Fix f) -> Fix f -> Fix fSource

Apply a transformation to a tree's direct children.

type Algebra fT aT = fT aT -> aTSource

Algebras for catamorphisms.

cata :: Functor fT => Algebra fT aT -> Fix fT -> aTSource

Reduces a tree to a value according to the algebra.

type Coalgebra fT aT = aT -> fT aTSource

Coalgebras for anamorphisms.

ana :: Functor fT => Coalgebra fT aT -> aT -> Fix fTSource

Constructs a tree from a value according to the coalgebra.

type ErrorAlgebra fT eT aT = fT aT -> Either eT aTSource

Algebras for error catamorphisms.

cascade :: (Traversable fT, Monoid eT) => ErrorAlgebra fT eT aT -> Algebra fT (Except eT aT)Source

Reduces a tree to a value according to the algebra, propagating potential errors.