packages feed

free-functors 0.1 → 0.1.1

raw patch · 2 files changed

+10/−3 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Functor.HFree: iter :: c Identity => (forall b. f b -> b) -> HFree c f a -> a
+ Data.Functor.HFree: wrap :: f (HFree Monad f a) -> HFree Monad f a

Files

free-functors.cabal view
@@ -1,5 +1,5 @@ name:                free-functors-version:             0.1+version:             0.1.1 synopsis:            Provides free functors that are adjoint to functors that forget class constraints.  description:         A free functor is a left adjoint to a forgetful functor. It used to be the case                      that the only category that was easy to work with in Haskell was Hask itself, so@@ -17,8 +17,8 @@ author:              Sjoerd Visscher maintainer:          sjoerd@w3future.com stability:           experimental-homepage:            http://github.com/sjoerdvisscher/free-functors-bug-reports:         http://github.com/sjoerdvisscher/free-functors/issues+homepage:            https://github.com/sjoerdvisscher/free-functors+bug-reports:         https://github.com/sjoerdvisscher/free-functors/issues  build-type:          Simple cabal-version:       >= 1.10
src/Data/Functor/HFree.hs view
@@ -24,6 +24,7 @@    import Control.Applicative import Control.Monad.Trans.Class+import Data.Functor.Identity   -- | Natural transformations.@@ -53,6 +54,9 @@ convert :: (c (t f), Functor (t f), Monad f, MonadTrans t) => HFree c f a -> t f a convert = rightAdjunct lift +iter :: c Identity => (forall b. f b -> b) -> HFree c f a -> a+iter f = runIdentity . rightAdjunct (Identity . f)+ -- | The free monad of a functor. instance Monad (HFree Monad f) where   return a = HFree $ const (return a)@@ -68,3 +72,6 @@ instance Alternative (HFree Alternative f) where   empty = HFree $ const empty   HFree f <|> HFree g = HFree $ \k -> f k <|> g k+  +wrap :: f (HFree Monad f a) -> HFree Monad f a+wrap ff = HFree $ \k -> k ff >>= rightAdjunct k