packages feed

monadic-recursion-schemes 0.1.9.1 → 0.1.10.0

raw patch · 3 files changed

+18/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Functor.Foldable.Monadic: gcataM :: (Monad m, Comonad w, Traversable w, Traversable (Base t), Recursive t, b ~ w a) => (Base t (w b) -> m (w (Base t b))) -> (Base t (w a) -> m a) -> t -> m a

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for monadic-recursion-schemes +## 0.1.10.0 -- 2020-05-21++* add new member 'gcataM' which is a generalized morphism of catamorphism.+ ## 0.1.9.1 -- 2020-05-17  * no warning at build time.
monadic-recursion-schemes.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/  name:                monadic-recursion-schemes-version:             0.1.9.1+version:             0.1.10.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
@@ -29,6 +29,9 @@   , chronoM, cochronoM   , chronoM' -- cochronoM' +    -- * Generalized Folding+  , gcataM+     -- * Others   , mutuM, comutuM   , mutuM', comutuM'@@ -38,7 +41,7 @@ import           Control.Comonad              (Comonad (..)) import           Control.Comonad.Cofree       (Cofree (..)) import qualified Control.Comonad.Trans.Cofree as CF (CofreeF (..))-import           Control.Monad                ((<=<), liftM2)+import           Control.Monad                ((<=<), liftM, liftM2) import           Control.Monad.Free           (Free (..)) import qualified Control.Monad.Trans.Free     as FR (FreeF (..)) import           Data.Functor.Foldable        (Recursive (..), Corecursive (..), Base)@@ -282,3 +285,12 @@          -> f a -> m (f a) iterateM f = u   where u = return . embed <=< mapM (mapM f) <=< mapM u . project+++-- | generalized catamorphism+gcataM :: (Monad m, Comonad w, Traversable w, Traversable (Base t), Recursive t, b ~ w a)+       => (Base t (w b) -> m (w (Base t b))) -- ^ Distributive (Base t) w b+       -> (Base t (w a) -> m a)              -- ^ algebra+       -> t -> m a+gcataM k g = liftM extract . cataM phi+  where phi = mapM g <=< k <=< return . fmap duplicate