free 0.2.1 → 0.2.2
raw patch · 3 files changed
+21/−1 lines, 3 filesdep +comonad-transformersPVP ok
version bump matches the API change (PVP)
Dependencies added: comonad-transformers
API changes (from Hackage documentation)
+ Control.Comonad.Cofree: instance ComonadTrans Cofree
+ Control.Monad.Free: instance MonadTrans Free
+ Control.Monad.Free: retract :: Monad f => Free f a -> f a
Files
- Control/Comonad/Cofree.hs +8/−0
- Control/Monad/Free.hs +11/−0
- free.cabal +2/−1
Control/Comonad/Cofree.hs view
@@ -21,6 +21,7 @@ import Control.Applicative import Control.Comonad+import Control.Comonad.Trans.Class import Data.Functor.Bind import Data.Distributive import Data.Foldable@@ -61,6 +62,13 @@ instance Functor f => Comonad (Cofree f) where extract (a :< _) = a++instance ComonadTrans Cofree where+ lower (_ :< as) = fmap extract as++-- | lower . section = id+section :: Comonad f => f a -> Cofree f a +section as = extract as :< extend section as instance Apply f => Apply (Cofree f) where (f :< fs) <.> (a :< as) = f a :< ((<.>) <$> fs <.> as)
Control/Monad/Free.hs view
@@ -14,10 +14,13 @@ ---------------------------------------------------------------------------- module Control.Monad.Free ( Free(..)+ , retract , iter ) where import Control.Applicative+import Control.Monad (liftM)+import Control.Monad.Trans.Class import Data.Functor.Bind import Data.Foldable import Data.Traversable@@ -80,6 +83,14 @@ return = Pure Pure a >>= f = f a Free m >>= f = Free ((>>= f) <$> m)++instance MonadTrans Free where+ lift = Free . liftM Pure++-- | retract . lift = id+retract :: Monad f => Free f a -> f a+retract (Pure a) = return a+retract (Free as) = as >>= retract instance Foldable f => Foldable (Free f) where foldMap f (Pure a) = f a
free.cabal view
@@ -1,6 +1,6 @@ name: free category: Control, Monads-version: 0.2.1+version: 0.2.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -24,6 +24,7 @@ transformers >= 0.2.0 && <= 0.3, semigroupoids >= 1.2.2 && <= 1.3, comonad >= 1.1 && < 1.2,+ comonad-transformers >= 1.6.3 && < 1.7, semigroups >= 0.5 && < 0.6 if impl(ghc)