|Portability||non-portable (rank-2 polymorphism)|
|Maintainer||Edward Kmett <email@example.com>|
See Maarten Fokkinga''s PhD Dissertation for cascade and prepro. g_prepro is an obvious generalization. The prepro variants of other morphisms are distributed through the corresponding files.
- prepro :: Functor f => Algebra f c -> (f :~> f) -> FixF f -> c
- g_prepro :: (Functor f, Comonad w) => Dist f w -> GAlgebra f w a -> (f :~> f) -> FixF f -> a
- cascade :: Bifunctor s Hask Hask Hask => (a -> a) -> Fix s a -> Fix s a
- biprepro :: Bifunctor f Hask Hask Hask => Algebra (f a) c -> (f a :~> f a) -> Fix f a -> c
- g_biprepro :: (Bifunctor f Hask Hask Hask, Comonad w) => Dist (f a) w -> GAlgebra (f a) w c -> (f a :~> f a) -> Fix f a -> c
Generalized prepromorphisms, parameterized by a comonad This is used to generate most of the specialized prepromorphisms in other modules. You can use the distributive law combinators to build up analogues of other recursion schemes.
cascade f . map f = map f . cascade f
cascade f = biprepro InB (first f)
cascade f = x where x = InB . bimap id (x . fmap f) . outB
cascade f = x where x = InB . bimap id (fmap f . x) . outB
Prepromorphisms for bifunctors