monadic-recursion-schemes 0.1.2.0 → 0.1.3.0
raw patch · 3 files changed
+41/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Functor.Foldable.Monadic: chronoM :: (Monad m, Traversable (Base t), Recursive t, Corecursive t) => (Base t (Cofree (Base t) c) -> m c) -> (a -> m (Base t (Free (Base t) a))) -> a -> m c
+ Data.Functor.Foldable.Monadic: chronoM' :: (Monad m, Traversable t) => (t (Cofree t b) -> m b) -> (a -> m (t (Free t a))) -> a -> m b
+ Data.Functor.Foldable.Monadic: cochronoM :: (Monad m, Corecursive c, Traversable (Base c), Traversable (Base t), Recursive t) => (Base t (Cofree (Base t) a) -> m a) -> (a -> m (Base c (Free (Base c) a))) -> t -> m c
Files
- CHANGELOG.md +13/−1
- monadic-recursion-schemes.cabal +1/−1
- src/Data/Functor/Foldable/Monadic.hs +27/−1
CHANGELOG.md view
@@ -1,5 +1,17 @@ # Revision history for monadic-recursion-schemes -## 0.1.0.0 -- YYYY-mm-dd+## 0.1.0.0 -- 2020-05-11 * First version. Released on an unsuspecting world.++## 0.1.1.0 -- 2020-05-11++* added histoM, futuM and the variants.++## 0.1.2.0 -- 2020-05-12++* added hyloM, metaM and the variants.++## 0.1.3.0 -- 2020-05-13++* added chronoM, cochronoM and the variants.
monadic-recursion-schemes.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/ name: monadic-recursion-schemes-version: 0.1.2.0+version: 0.1.3.0 synopsis: Recursion Schemes for Monadic version. description: Yet another recursion schemes for monadic style, depends on recursion-schemes. homepage: https://github.com/cutsea110/monadic-recursion-schemes.git
src/Data/Functor/Foldable/Monadic.hs view
@@ -13,6 +13,8 @@ , histoM', futuM' , zygoM, cozygoM , hyloM, metaM+ , chronoM, cochronoM+ , chronoM', -- cochronoM' ) where import Control.Comonad (Comonad (..))@@ -67,7 +69,7 @@ => (Base t (Cofree (Base t) a) -> m a) -> t -> m a histoM' phi = return . extract <=< cataM f- where f = return . uncurry (:<) <=< (liftM2 (,) <$> phi <*> return)+ where f = liftM2 (:<) <$> phi <*> return -- | futumorphism on catamorphism variant futuM :: (Monad m, Traversable (Base t), Corecursive t)@@ -133,3 +135,27 @@ -> (a -> m (Base c a)) -- ^ coalgebra -> t -> m c metaM' phi psi = anaM psi <=< cataM phi++-- | chronomorphism on recursive variant over hylomorphism+chronoM' :: (Monad m, Traversable t)+ => (t (Cofree t b) -> m b) -- ^ algebra+ -> (a -> m (t (Free t a))) -- ^ coalgebra+ -> a -> m b+chronoM' phi psi = return . extract <=< hyloM f g . Pure+ where f = liftM2 (:<) <$> phi <*> return+ g (Pure a) = psi a+ g (Free fb) = return fb++-- FIXME: I couldn't compile with this type signature.+-- | chronomorphism on combination variant of futu to hist+-- chronoM' :: (Monad m, Traversable (Base t), Recursive t, Corecursive t)+-- => (Base t (Cofree (Base t) c) -> m c) -- ^ algebra+-- -> (a -> m (Base t (Free (Base t) a))) -- ^ coalgebra+-- -> a -> m c+chronoM phi psi = histoM phi <=< futuM psi++cochronoM :: (Monad m, Corecursive c, Traversable (Base c), Traversable (Base t), Recursive t)+ => (Base t (Cofree (Base t) a) -> m a)+ -> (a -> m (Base c (Free (Base c) a)))+ -> t -> m c+cochronoM phi psi = futuM psi <=< histoM phi