Zygohistomorphic prepromorphisms - HaskellWiki
Jump to content
HaskellWiki
Search
Search
Log in
Personal tools
Log in
From HaskellWiki
Zygohistomorphic prepromorphisms are an intentionally overcomplicated combination of recursion-schemes concepts that started as a joke[1].
Used when you really need both semi-mutual recursion and history and to repeatedly apply a natural transformation as you get deeper into the functor. Zygo implements semi-mutual recursion like a zygomorphism. Para gives you access to your result à la paramorphism.
import Control.Morphism.Zygo<br>import Control.Morphism.Prepro<br>import Control.Morphism.Histo<br>import Control.Functor.Algebra<br>import Control.Functor.Extras
zygoHistoPrepro<br>:: (Unfoldable t, Foldable t)<br>=> (Base t b -> b)<br>-> (forall c. Base t c -> Base t c)<br>-> (Base t (EnvT b (Stream (Base t)) a) -> a)<br>-> t<br>-> a<br>zygoHistoPrepro f g t = gprepro (distZygoT f distHisto) g t<br>-- unless you want a generalized zygomorphism.
↑ [1] Edward Kmett on Twitter, 2019
Retrieved from "https://wiki.haskell.org/index.php?title=Zygohistomorphic_prepromorphisms&oldid=66365"
Categories: Pages with syntax highlighting errors<br>Code<br>Language extensions
Search
Search
Zygohistomorphic prepromorphisms
Add topic