category-extras-0.53.0: Various modules and constructs inspired by category theory

Portabilitynon-portable (rank-2 polymorphism)
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>

Control.Functor.Algebra.Elgot

Description

Elgot algebras, and their obvious dual, based on: http://www.iti.cs.tu-bs.de/~milius/research/elgot_lmcs.pdf

Elgot algebras given you a shortcircuitable hylomorphism where you can directly return a sub-answer to the catamorphism.

Elgot coalgebras are defined in: http://comonad.com/reader/2008/elgot-coalgebras/

Synopsis

Documentation

elgot :: Functor f => Algebra f a -> (b -> Either a (f b)) -> b -> aSource

Elgot algebra

coelgot :: Functor f => ((a, f b) -> b) -> Coalgebra f a -> a -> bSource

Elgot coalgebra