-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A recursion schemes library for GHC. -- -- A performant recursion schemes library for Haskell with minimal -- dependencies @package recursion @version 1.2.1.0 module Control.Recursion class (Functor (Base t)) => Recursive t project :: Recursive t => t -> Base t t class (Functor (Base t)) => Corecursive t embed :: Corecursive t => Base t t -> t newtype Fix f Fix :: f (Fix f) -> Fix f [unFix] :: Fix f -> f (Fix f) newtype Mu f Mu :: (forall a. (f a -> a) -> a) -> Mu f data Nu f Nu :: (a -> f a) -> a -> Nu f data ListF a b Cons :: a -> b -> ListF a b Nil :: ListF a b data NonEmptyF a b NonEmptyF :: a -> (Maybe b) -> NonEmptyF a b -- | Base functor for a list of type [a]. | Hylomorphism; fold a -- structure while buildiung it up. hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b -- | Prepromorphism. Fold a structure while applying a natural -- transformation at each step. prepro :: (Recursive t, Corecursive t) => (Base t t -> Base t t) -> (Base t a -> a) -> t -> a -- | Postpromorphism. Build up a structure, applying a natural -- transformation along the way. postpro :: (Recursive t, Corecursive t) => (Base t t -> Base t t) -> (a -> Base t a) -> a -> t -- | A mutumorphism. mutu :: (Recursive t) => (Base t (a, a) -> a) -> (Base t (a, a) -> a) -> t -> a -- | Zygomorphism (see here for a neat example) zygo :: (Recursive t) => (Base t b -> b) -> (Base t (b, a) -> a) -> t -> a -- | Paramorphism para :: (Recursive t, Corecursive t) => (Base t (t, a) -> a) -> t -> a -- | Apomorphism. Compare micro. apo :: (Corecursive t) => (a -> Base t (Either t a)) -> a -> t -- | Elgot algebra (see this paper) elgot :: Functor f => (f a -> a) -> (b -> Either a (f b)) -> b -> a -- | Elgot coalgebra coelgot :: Functor f => ((a, f b) -> b) -> (a -> f a) -> a -> b -- | Anamorphism allowing shortcuts. Compare apo micro :: (Corecursive a) => (b -> Either a (Base a b)) -> b -> a -- | Gibbons' metamorphism. Tear down a structure, transform it, and then -- build up a new structure meta :: (Corecursive t', Recursive t) => (a -> Base t' a) -> (b -> a) -> (Base t b -> b) -> t -> t' -- | Erwig's metamorphism. Essentially a hylomorphism with a natural -- transformation in between. This allows us to use more than one functor -- in a hylomorphism. meta' :: (Functor g) => (f a -> a) -> (forall c. g c -> f c) -> (b -> g b) -> b -> a -- | Catamorphism collapsing along two data types simultaneously. Basically -- a fancy zygomorphism. dicata :: (Recursive t) => (Base t (a, t) -> a) -> (Base t (a, t) -> t) -> t -> a -- | Catamorphism. Folds a structure. (see here) cata :: (Recursive t) => (Base t a -> a) -> t -> a -- | Anamorphism, meant to build up a structure recursively. ana :: (Corecursive t) => (a -> Base t a) -> a -> t -- | Mendler's histomorphism mhisto :: (forall y. ((y -> c) -> (y -> f y) -> f y -> c)) -> Fix f -> c -- | Mendler's catamorphism mcata :: (forall y. ((y -> c) -> f y -> c)) -> Fix f -> c cataM :: (Recursive t, Traversable (Base t), Monad m) => (Base t a -> m a) -> t -> m a anaM :: (Corecursive t, Traversable (Base t), Monad m) => (a -> m (Base t a)) -> a -> m t hyloM :: (Traversable f, Monad m) => (f b -> m b) -> (a -> m (f a)) -> a -> m b -- | Entangle two hylomorphisms. scolio :: (Functor g) => ((f b -> b) -> Trans b b) -> ((a -> f a) -> Lens a a) -> (g b -> b) -> (a -> g a) -> (f b -> b) -> (a -> f a) -> a -> b -- | A dendromorphism entangles two catamorphisms dendro :: (Recursive t') => ((f a -> a) -> Trans b b) -> (f a -> a) -> (Base t' b -> b) -> t' -> b chema :: (Corecursive t') => ((a -> f a) -> Lens b b) -> (a -> f a) -> (b -> Base t' b) -> b -> t' lambek :: (Recursive t, Corecursive t) => (t -> Base t t) colambek :: (Recursive t, Corecursive t) => (Base t t -> t) hoist :: (Recursive s, Corecursive t) => (forall a. Base s a -> Base t a) -> s -> t refix :: (Recursive s, Corecursive t, Base s ~ Base t) => s -> t instance GHC.Base.Functor (Control.Recursion.NonEmptyF a) instance GHC.Base.Functor (Control.Recursion.ListF a) instance GHC.Base.Functor f => Control.Recursion.Recursive (Control.Recursion.Mu f) instance GHC.Base.Functor f => Control.Recursion.Corecursive (Control.Recursion.Mu f) instance GHC.Base.Functor f => Control.Recursion.Recursive (Control.Recursion.Nu f) instance GHC.Base.Functor f => Control.Recursion.Corecursive (Control.Recursion.Nu f) instance GHC.Base.Functor f => Control.Recursion.Recursive (Control.Recursion.Fix f) instance GHC.Base.Functor f => Control.Recursion.Corecursive (Control.Recursion.Fix f) instance Control.Recursion.Recursive (GHC.Base.NonEmpty a) instance Control.Recursion.Corecursive (GHC.Base.NonEmpty a) instance Control.Recursion.Recursive [a] instance Control.Recursion.Corecursive [a] instance Control.Recursion.Corecursive GHC.Natural.Natural instance Control.Recursion.Recursive GHC.Natural.Natural