monadic-recursion-schemes 0.1.3.4 → 0.1.4.0
raw patch · 3 files changed
+51/−18 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Functor.Foldable.Monadic: codynaM :: (Monad m, Corecursive c, Traversable (Base c), Traversable (Base t), Recursive t) => (Base t (Cofree (Base t) a) -> m a) -> (a -> m (Base c a)) -> t -> m c
+ Data.Functor.Foldable.Monadic: dynaM :: forall m t a c. (Monad m, Traversable (Base t), Recursive t, Corecursive t) => (Base t (Cofree (Base t) c) -> m c) -> (a -> m (Base t a)) -> a -> m c
+ Data.Functor.Foldable.Monadic: dynaM' :: (Monad m, Traversable t) => (t (Cofree t c) -> m c) -> (a -> m (t a)) -> a -> m c
Files
- CHANGELOG.md +17/−14
- monadic-recursion-schemes.cabal +8/−2
- src/Data/Functor/Foldable/Monadic.hs +26/−2
CHANGELOG.md view
@@ -1,34 +1,37 @@ # Revision history for monadic-recursion-schemes -## 0.1.0.0 -- 2020-05-11+## 0.1.4.0 -- 2020-05-14 -* First version. Released on an unsuspecting world.+* add dynaM, codynaM and dynaM' the recursive variant. -## 0.1.1.0 -- 2020-05-11+## 0.1.3.4 -- 2020-05-13 -* added histoM, futuM and the variants.+* add type signature for hyloM' and chronoM. -## 0.1.2.0 -- 2020-05-12+## 0.1.3.3 -- 2020-05-13 -* added hyloM, metaM and the variants.+* added comment -## 0.1.3.0 -- 2020-05-13+## 0.1.3.2 -- 2020-05-13 -* added chronoM, cochronoM and the variants.+* export the variants for hyloM and metaM. ## 0.1.3.1 -- 2020-05-13 * added comment -## 0.1.3.2 -- 2020-05-13+## 0.1.3.0 -- 2020-05-13 -* export the variants for hyloM and metaM.+* added chronoM, cochronoM and the variants. -## 0.1.3.3 -- 2020-05-13+## 0.1.2.0 -- 2020-05-12 -* added comment+* added hyloM, metaM and the variants. -## 0.1.3.4 -- 2020-05-13+## 0.1.1.0 -- 2020-05-11 -* add type signature for hyloM' and chronoM.+* added histoM, futuM and the variants. +## 0.1.0.0 -- 2020-05-11++* First version. Released on an unsuspecting world.
monadic-recursion-schemes.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/ name: monadic-recursion-schemes-version: 0.1.3.4+version: 0.1.4.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@@ -20,7 +20,13 @@ library exposed-modules: Data.Functor.Foldable.Monadic -- other-modules:- -- other-extensions:+ other-extensions: GADTs,+ LambdaCase,+ DeriveFunctor,+ DeriveFoldable,+ DeriveTraversable,+ AllowAmbiguousTypes,+ ScopedTypeVariables build-depends: base ^>=4.12.0.0, containers >=0.6, mtl >=2.2.2,
src/Data/Functor/Foldable/Monadic.hs view
@@ -6,7 +6,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeFamilyDependencies #-} module Data.Functor.Foldable.Monadic ( cataM, anaM , paraM, apoM@@ -16,7 +15,9 @@ , hyloM, metaM , hyloM', metaM' , chronoM, cochronoM- , chronoM', -- cochronoM'+ , chronoM' -- cochronoM'+ , dynaM, codynaM+ , dynaM' -- codynaM' ) where import Control.Comonad (Comonad (..))@@ -154,8 +155,31 @@ -> a -> m b chronoM phi psi = (histoM phi :: t -> m b) <=< (futuM psi :: a -> m t) +-- | cochronomorphism on combination variant of histo to futu cochronoM :: (Monad m, Corecursive c, Traversable (Base c), Traversable (Base t), Recursive t) => (Base t (Cofree (Base t) a) -> m a) -- ^ algebra -> (a -> m (Base c (Free (Base c) a))) -- ^ coalgebra -> t -> m c cochronoM phi psi = futuM psi <=< histoM phi++-- | dynamorphism on recursive variant over hylomorphism+dynaM' :: (Monad m, Traversable t)+ => (t (Cofree t c) -> m c) -- ^ algebra+ -> (a -> m (t a)) -- ^ coalgebra+ -> a -> m c+dynaM' phi psi = return . extract <=< hyloM f psi+ where f = liftM2 (:<) <$> phi <*> return++-- | dynamorphism on combination variant of ana to histo+dynaM :: forall m t a c. (Monad m, Traversable (Base t), Recursive t, Corecursive t)+ => (Base t (Cofree (Base t) c) -> m c) -- ^ algebra+ -> (a -> m (Base t a)) -- ^ coalgebra+ -> a -> m c+dynaM phi psi = (histoM phi :: t -> m c) <=< (anaM psi :: a -> m t)++-- | codynamorphism on combination variant of histo to ana+codynaM :: (Monad m, Corecursive c, Traversable (Base c), Traversable (Base t), Recursive t)+ => (Base t (Cofree (Base t) a) -> m a) -- ^ algebra+ -> (a -> m (Base c a)) -- ^ coalgebra+ -> t -> m c+codynaM phi psi = anaM psi <=< histoM phi