module Control.Morphism.Para
( Para
, ParaT
, distParaT
, para, g_para
, prepro_para, g_prepro_para
) where
import Control.Comonad
import Control.Comonad.Reader
import Control.Functor.Algebra
import Control.Functor.Extras
import Control.Functor.Fix
import Control.Morphism.Cata
import Control.Morphism.Zygo
import Control.Morphism.Prepro
type Para f = (,) (FixF f)
type ParaT w f = CoreaderT w (FixF f)
distParaT :: (Functor f, Comonad w) => Dist f w -> Dist f (ParaT w f)
distParaT = distZygoT (liftAlgebra InF)
para :: Functor f => GAlgebra f (Para f) a -> FixF f -> a
para = zygo InF
g_para :: (Functor f, Comonad w) => Dist f w -> GAlgebra f (ParaT w f) a -> FixF f -> a
g_para f = g_cata (distParaT f)
prepro_para :: Functor f => GAlgebra f (Para f) a -> (f :~> f) -> FixF f -> a
prepro_para = prepro_zygo InF
g_prepro_para :: (Functor f, Comonad w) => Dist f w -> GAlgebra f (ParaT w f) a -> (f :~> f) -> FixF f -> a
g_prepro_para f = g_prepro (distParaT f)