Safe Haskell | Safe |
---|---|

Language | Haskell98 |

- newtype Fix fT = In {}
- compos :: Functor f => (Fix f -> Fix f) -> Fix f -> Fix f
- type Algebra fT aT = fT aT -> aT
- cata :: Functor fT => Algebra fT aT -> Fix fT -> aT
- type Coalgebra fT aT = aT -> fT aT
- ana :: Functor fT => Coalgebra fT aT -> aT -> Fix fT
- type ErrorAlgebra fT eT aT = fT aT -> Either eT aT
- cascade :: (Traversable fT, Monoid eT) => ErrorAlgebra fT eT aT -> Algebra fT (Except eT aT)

# Fixed points of functors

Fixpoint of functors.

compos :: Functor f => (Fix f -> Fix f) -> Fix f -> Fix f Source #

Apply a transformation to a tree's direct children.

cata :: Functor fT => Algebra fT aT -> Fix fT -> aT Source #

Reduces a tree to a value according to the algebra.

ana :: Functor fT => Coalgebra fT aT -> aT -> Fix fT Source #

Constructs a tree from a value according to the coalgebra.

type ErrorAlgebra fT eT aT = fT aT -> Either eT aT Source #

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.