Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Several extensions to Edward Kmett's recursion schemes package. The monadic recursion schemes and exotic recursion schemes should be stable, but the recursion schemes for interdependent data type (and their attendant typeclasses) are experimental.
- class (Functor f, Functor g) => SubHom f g a b where
- class SubType b where
- class (Functor f, Functor g) => CoSubHom f g a b where
- class Dummy t where
- 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 :: (Functor f, Monad m, Traversable f) => (f b -> m b) -> (a -> m (f a)) -> a -> m b
- dendro :: (SubHom (Base t) (Base t') a b, SubType b, Recursive t') => t -> (Base t a -> a) -> (Base t' b -> b) -> t' -> b
- dendroTri :: (SubHom (Base t) (Base t') a b, SubType b, Recursive t', SubHom (Base t'') (Base t) c a, SubType a, Recursive t) => t -> t'' -> (Base t'' c -> c) -> (Base t a -> a) -> (Base t' b -> b) -> t' -> b
- symplecto :: (SubHom g f b b, CoSubHom g f a a) => (g b -> b) -> (a -> g a) -> (f b -> b) -> (a -> f a) -> a -> b
- chema :: (CoSubHom (Base t) (Base t') a b, SubType b, Corecursive t') => t -> (a -> Base t a) -> (b -> Base t' b) -> b -> t'
- dicata :: Recursive a => (Base a (b, a) -> b) -> (Base a (b, a) -> a) -> a -> b
- micro :: Corecursive a => (b -> Either a (Base a b)) -> b -> a
Classes
class (Functor f, Functor g) => SubHom f g a b where Source #
Class that yields g-algebra homomorphisms between mutually recursive types.
class (Functor f, Functor g) => CoSubHom f g a b where Source #
Class that yields g-coalgebra homomorphisms between mutually recursive types.
We need this class to make type resolution work.
Monadic recursion schemes
cataM :: (Recursive t, Traversable (Base t), Monad m) => (Base t a -> m a) -> t -> m a Source #
A monadic catamorphism
anaM :: (Corecursive t, Traversable (Base t), Monad m) => (a -> m (Base t a)) -> a -> m t Source #
A monadic anamorphism
hyloM :: (Functor f, Monad m, Traversable f) => (f b -> m b) -> (a -> m (f a)) -> a -> m b Source #
A monadic hylomorphism
Recursion schemes for interdependent data types
:: (SubHom (Base t) (Base t') a b, SubType b, Recursive t') | |
=> t | dummy type |
-> (Base t a -> a) | A (Base t)-algebra |
-> (Base t' b -> b) | A (Base t')-algebra |
-> t' | |
-> b |
A dendromorphism entangles two catamorphisms
:: (SubHom (Base t) (Base t') a b, SubType b, Recursive t', SubHom (Base t'') (Base t) c a, SubType a, Recursive t) | |
=> t | dummy type |
-> t'' | another dummy type |
-> (Base t'' c -> c) | A (Base t'')-algebra |
-> (Base t a -> a) | |
-> (Base t' b -> b) | |
-> t' | |
-> b |
Entangle three base functors.
:: (SubHom g f b b, CoSubHom g f a a) | |
=> (g b -> b) | A g-algebra |
-> (a -> g a) | A g-coalgebra |
-> (f b -> b) | An f-algebra |
-> (a -> f a) | An f-coalgebra |
-> a | |
-> b |
Entangle two hylomorphisms. Not the same thing as a symplectomorphism from geometry.