recursion-schemes 0.4.3 → 0.5.0
raw patch · 2 files changed
+11/−12 lines, 2 filesdep −freedep ~comonad-transformers
Dependencies removed: free
Dependency ranges changed: comonad-transformers
Files
- Data/Functor/Foldable.hs +9/−9
- recursion-schemes.cabal +2/−3
Data/Functor/Foldable.hs view
@@ -69,13 +69,13 @@ import Control.Comonad import Control.Comonad.Trans.Class import Control.Comonad.Trans.Env+import qualified Control.Comonad.Trans.Cofree as Cofree+import Control.Comonad.Trans.Cofree (Cofree(..)) import Control.Monad (liftM, join)-import Control.Monad.Free+import Control.Monad.Trans.Free import Data.Functor.Identity import Control.Arrow import Data.Function (on)-import qualified Data.Stream.Branching as Stream-import Data.Stream.Branching (Stream(..)) import Text.Read import Data.Data hiding (gunfold) import qualified Data.Data as Data@@ -394,17 +394,17 @@ distGApo f = either (fmap Left . f) (fmap Right) -- | Course-of-value iteration-histo :: Foldable t => (Base t (Stream (Base t) a) -> a) -> t -> a+histo :: Foldable t => (Base t (Cofree (Base t) a) -> a) -> t -> a histo = gcata distHisto -ghisto :: (Foldable t, Functor h) => (forall b. Base t (h b) -> h (Base t b)) -> (Base t (Stream h a) -> a) -> t -> a+ghisto :: (Foldable t, Functor h) => (forall b. Base t (h b) -> h (Base t b)) -> (Base t (Cofree h a) -> a) -> t -> a ghisto g = gcata (distGHisto g) -distHisto :: Functor f => f (Stream f a) -> Stream f (f a)+distHisto :: Functor f => f (Cofree f a) -> Cofree f (f a) distHisto = distGHisto id -distGHisto :: (Functor f, Functor h) => (forall b. f (h b) -> h (f b)) -> f (Stream h a) -> Stream h (f a)-distGHisto k = Stream.unfold (\as -> (Stream.head <$> as, k (Stream.tail <$> as)))+distGHisto :: (Functor f, Functor h) => (forall b. f (h b) -> h (f b)) -> f (Cofree h a) -> Cofree h (f a)+distGHisto k = Cofree.unfold (\as -> (extract <$> as, k (Cofree.unwrap <$> as))) -- TODO: futu & chrono, these require Free monads -- TODO: distGApoT, requires EitherT@@ -432,7 +432,7 @@ :: (Unfoldable t, Foldable t) => (Base t b -> b) -> (forall c. Base t c -> Base t c)- -> (Base t (EnvT b (Stream (Base t)) a) -> a)+ -> (Base t (EnvT b (Cofree (Base t)) a) -> a) -> t -> a zygoHistoPrepro f g t = gprepro (distZygoT f distHisto) g t
recursion-schemes.cabal view
@@ -1,6 +1,6 @@ name: recursion-schemes category: Control, Recursion-version: 0.4.3+version: 0.5.0 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -48,8 +48,7 @@ base >= 4 && < 4.4, transformers >= 0.2 && < 0.3, comonad >= 1.1 && < 1.2,- comonad-transformers >= 1.6.2 && < 1.7,- free >= 0.2 && < 0.3,+ comonad-transformers >= 1.7 && < 1.8, streams >= 0.7 && < 0.8 exposed-modules: