packages feed

comonad-transformers 0.7.0 → 0.9.0

raw patch · 9 files changed

+72/−34 lines, 9 filesdep +semigroupsdep ~comonaddep ~functor-applyPVP ok

version bump matches the API change (PVP)

Dependencies added: semigroups

Dependency ranges changed: comonad, functor-apply

API changes (from Hackage documentation)

- Control.Comonad.Trans.Env.Lazy: instance (Monoid e, ComonadApply w) => ComonadApply (EnvT e w)
- Control.Comonad.Trans.Env.Lazy: instance (Monoid e, FunctorApply w) => FunctorApply (EnvT e w)
- Control.Comonad.Trans.Env.Strict: instance (Monoid e, ComonadApply w) => ComonadApply (EnvT e w)
- Control.Comonad.Trans.Env.Strict: instance (Monoid e, FunctorApply w) => FunctorApply (EnvT e w)
- Control.Comonad.Trans.Stream: instance (ComonadApply w, FunctorApply f) => ComonadApply (StreamT f w)
- Control.Comonad.Trans.Stream: instance (ComonadApply w, FunctorApply f) => FunctorApply (StreamT f w)
- Control.Comonad.Trans.Stream: instance (Data1 f, Data1 w) => Data1 (Node f w)
- Control.Comonad.Trans.Stream: instance (Data1 f, Data1 w) => Data1 (StreamT f w)
- Control.Comonad.Trans.Stream: instance (Data1 f, Data1 w, Data a) => Data (Node f w a)
- Control.Comonad.Trans.Stream: instance (Data1 f, Data1 w, Data a) => Data (StreamT f w a)
- Control.Comonad.Trans.Traced: instance (Comonad w, Monoid m) => Comonad (TracedT m w)
- Control.Comonad.Trans.Traced: instance (Monoid m, ComonadApply w) => ComonadApply (TracedT m w)
- Control.Comonad.Trans.Traced: instance (Monoid m, FunctorApply w) => FunctorApply (TracedT m w)
- Control.Comonad.Trans.Traced: instance Monoid m => ComonadHoist (TracedT m)
- Control.Comonad.Trans.Traced: instance Monoid m => ComonadTrans (TracedT m)
+ Control.Comonad.Trans.Discont.Lazy: instance Extend (DiscontT s w)
+ Control.Comonad.Trans.Discont.Strict: instance Extend (DiscontT s w)
+ Control.Comonad.Trans.Env.Lazy: instance (Semigroup e, Apply w) => Apply (EnvT e w)
+ Control.Comonad.Trans.Env.Lazy: instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e w)
+ Control.Comonad.Trans.Env.Lazy: instance Extend w => Extend (EnvT e w)
+ Control.Comonad.Trans.Env.Strict: instance (Semigroup e, Apply w) => Apply (EnvT e w)
+ Control.Comonad.Trans.Env.Strict: instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e w)
+ Control.Comonad.Trans.Env.Strict: instance Extend w => Extend (EnvT e w)
+ Control.Comonad.Trans.Store.Lazy: instance Extend w => Extend (StoreT s w)
+ Control.Comonad.Trans.Store.Strict: instance Extend w => Extend (StoreT s w)
+ Control.Comonad.Trans.Stream: instance (Comonad w, Functor f) => Extend (StreamT f w)
+ Control.Comonad.Trans.Stream: instance (ComonadApply w, Apply f) => Apply (StreamT f w)
+ Control.Comonad.Trans.Stream: instance (ComonadApply w, Apply f) => ComonadApply (StreamT f w)
+ Control.Comonad.Trans.Stream: instance (Typeable1 f, Typeable1 w, Data (w (Node f w a)), Data (Node f w a), Data (f (StreamT f w a)), Data a) => Data (StreamT f w a)
+ Control.Comonad.Trans.Stream: instance (Typeable1 f, Typeable1 w, Data a, Data (f (StreamT f w a)), Data (StreamT f w a)) => Data (Node f w a)
+ Control.Comonad.Trans.Traced: instance (Apply w, Semigroup m, Monoid m) => Apply (TracedT m w)
+ Control.Comonad.Trans.Traced: instance (Comonad w, Semigroup m, Monoid m) => Comonad (TracedT m w)
+ Control.Comonad.Trans.Traced: instance (ComonadApply w, Semigroup m, Monoid m) => ComonadApply (TracedT m w)
+ Control.Comonad.Trans.Traced: instance (Extend w, Semigroup m) => Extend (TracedT m w)
+ Control.Comonad.Trans.Traced: instance (Semigroup m, Monoid m) => ComonadHoist (TracedT m)
+ Control.Comonad.Trans.Traced: instance (Semigroup m, Monoid m) => ComonadTrans (TracedT m)

Files

Control/Comonad/Trans/Discont/Lazy.hs view
@@ -68,12 +68,17 @@ instance Functor (DiscontT s w) where   fmap g ~(DiscontT f ws) = DiscontT (g . f) ws +instance Extend (DiscontT s w) where+  duplicate ~(DiscontT f ws) = DiscontT (DiscontT f) ws+ instance Comonad (DiscontT s w) where   extract ~(DiscontT f ws) = f ws-  duplicate ~(DiscontT f ws) = DiscontT (DiscontT f) ws  instance ComonadTrans (DiscontT s) where   lower ~(DiscontT f s) = extend f s++-- instance Apply w => Apply (DiscontT s w) where+-- instance ComonadApply w => ComonadApply (DiscontT s w)   label :: Comonad w => DiscontT s w a -> s  label ~(DiscontT _ ws) = extract ws
Control/Comonad/Trans/Discont/Strict.hs view
@@ -66,10 +66,12 @@ instance Functor (DiscontT s w) where   fmap g (DiscontT f ws) = DiscontT (g . f) ws -instance Comonad (DiscontT s w) where-  extract (DiscontT f ws) = f ws+instance Extend (DiscontT s w) where   duplicate (DiscontT f ws) = DiscontT (DiscontT f) ws   extend g (DiscontT f ws) = DiscontT (g . DiscontT f) ws++instance Comonad (DiscontT s w) where+  extract (DiscontT f ws) = f ws  instance ComonadTrans (DiscontT s) where   lower (DiscontT f s) = extend f s
Control/Comonad/Trans/Env/Lazy.hs view
@@ -38,7 +38,7 @@ import Data.Functor.Identity import Data.Foldable import Data.Traversable-import Data.Monoid+import Data.Semigroup  #ifdef __GLASGOW_HASKELL__ import Data.Data.Extras@@ -114,14 +114,16 @@ instance Functor w => Functor (EnvT e w) where   fmap g ~(EnvT e wa) = EnvT e (fmap g wa) +instance Extend w => Extend (EnvT e w) where+  duplicate ~(EnvT e wa) = EnvT e (extend (EnvT e) wa)+ instance Comonad w => Comonad (EnvT e w) where   extract ~(EnvT _ wa) = extract wa-  duplicate p@(~(EnvT e wa)) = EnvT e (p <$ wa) -instance (Monoid e, FunctorApply w) => FunctorApply (EnvT e w) where-  ~(EnvT ef wf) <.> ~(EnvT ea wa) = EnvT (ef `mappend` ea) (wf <.> wa)+instance (Semigroup e, Apply w) => Apply (EnvT e w) where+  ~(EnvT ef wf) <.> ~(EnvT ea wa) = EnvT (ef <> ea) (wf <.> wa) -instance (Monoid e, ComonadApply w) => ComonadApply (EnvT e w)+instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e w)  instance ComonadTrans (EnvT e) where   lower ~(EnvT _ wa) = wa
Control/Comonad/Trans/Env/Strict.hs view
@@ -37,7 +37,7 @@ import Data.Traversable import Data.Functor.Apply import Data.Functor.Identity-import Data.Monoid+import Data.Semigroup  #ifdef __GLASGOW_HASKELL__ import Data.Data.Extras@@ -113,9 +113,11 @@ instance Functor w => Functor (EnvT e w) where   fmap g (EnvT e wa) = EnvT e (fmap g wa) +instance Extend w => Extend (EnvT e w) where+  duplicate (EnvT e wa) = EnvT e (extend (EnvT e) wa)+ instance Comonad w => Comonad (EnvT e w) where   extract (EnvT _ wa) = extract wa-  duplicate p@(EnvT e wa) = EnvT e (p <$ wa)  instance ComonadTrans (EnvT e) where   lower (EnvT _ wa) = wa@@ -123,10 +125,10 @@ instance ComonadHoist (EnvT e) where   cohoist (EnvT e wa) = EnvT e (Identity (extract wa)) -instance (Monoid e, FunctorApply w) => FunctorApply (EnvT e w) where-  EnvT ef wf <.> EnvT ea wa = EnvT (ef `mappend` ea) (wf <.> wa)+instance (Semigroup e, Apply w) => Apply (EnvT e w) where+  EnvT ef wf <.> EnvT ea wa = EnvT (ef <> ea) (wf <.> wa) -instance (Monoid e, ComonadApply w) => ComonadApply (EnvT e w)+instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e w)  instance Foldable w => Foldable (EnvT e w) where   foldMap f (EnvT _ w) = foldMap f w
Control/Comonad/Trans/Store/Lazy.hs view
@@ -69,10 +69,12 @@ instance Functor w => Functor (StoreT s w) where   fmap f ~(StoreT wf s) = StoreT (fmap (f .) wf) s -instance Comonad w => Comonad (StoreT s w) where-  extract ~(StoreT wf s) = extract wf s+instance Extend w => Extend (StoreT s w) where   duplicate ~(StoreT wf s) = StoreT (extend StoreT wf) s   extend f ~(StoreT wf s) = StoreT (extend (\wf' s' -> f (StoreT wf' s')) wf) s++instance Comonad w => Comonad (StoreT s w) where+  extract ~(StoreT wf s) = extract wf s  instance ComonadTrans (StoreT s) where   lower ~(StoreT f s) = fmap ($s) f
Control/Comonad/Trans/Store/Strict.hs view
@@ -69,10 +69,12 @@ instance Functor w => Functor (StoreT s w) where   fmap f (StoreT wf s) = StoreT (fmap (f .) wf) s -instance Comonad w => Comonad (StoreT s w) where-  extract (StoreT wf s) = extract wf s+instance Extend w => Extend (StoreT s w) where   duplicate (StoreT wf s) = StoreT (extend StoreT wf) s   extend f (StoreT wf s) = StoreT (extend (\wf' s' -> f (StoreT wf' s')) wf) s++instance Comonad w => Comonad (StoreT s w) where+  extract (StoreT wf s) = extract wf s  instance ComonadTrans (StoreT s) where   lower (StoreT f s) = fmap ($s) f
Control/Comonad/Trans/Stream.hs view
@@ -101,16 +101,19 @@ instance (Functor w, Functor f) => Functor (StreamT f w) where   fmap f = StreamT . fmap (fmap f) . runStreamT -instance (Comonad w, Functor f) => Comonad (StreamT f w) where-  extract = fstN . extract . runStreamT+-- TODO: relax requirement to just Extend+instance (Comonad w, Functor f) => Extend (StreamT f w) where   duplicate = StreamT . extend (\w -> StreamT w :< (duplicate <$> sndN (extract w))) . runStreamT   extend f = StreamT . extend (\w -> f (StreamT w) :< (extend f <$> sndN (extract w))) . runStreamT -instance (ComonadApply w, FunctorApply f) => FunctorApply (StreamT f w) where+instance (Comonad w, Functor f) => Comonad (StreamT f w) where+  extract = fstN . extract . runStreamT++instance (ComonadApply w, Apply f) => Apply (StreamT f w) where   StreamT ffs <.> StreamT aas = StreamT (liftW2 wfa ffs aas) where     wfa (f :< fs) (a :< as) = f a :< ((<.>) <$> fs <.> as) -instance (ComonadApply w, FunctorApply f) => ComonadApply (StreamT f w)+instance (ComonadApply w, Apply f) => ComonadApply (StreamT f w)  instance Functor f => ComonadTrans (StreamT f) where   lower = fmap fstN . runStreamT@@ -125,6 +128,9 @@ instance (Traversable w, Traversable f) => Traversable (StreamT f w) where   traverse f (StreamT w) = StreamT <$> traverse (\(a :< as) -> (:<) <$> f a <*> traverse (traverse f) as) w +-- TODO+-- instance (Distributive w, Distributive f) => Distributive (StreamT f w) where+ {- instance Show a => Show (Identity a) where   showsPrec d (Identity a) = showParen (d > 10) $@@ -168,6 +174,7 @@ streamTTyCon = mkTyCon "Control.Comonad.Trans.Stream.StreamT" {-# NOINLINE streamTTyCon #-} +{- instance (Data1 f, Data1 w) => Data1 (Node f w) where   gfoldl1 k z (a :< as) = liftK k (z (:<) `k` a) as   toConstr1 _ = nodeConstr@@ -176,7 +183,18 @@     _ -> error "gunfold"   dataTypeOf1 _ = nodeDataType   dataCast1_1 f = gcast1 f+-} +instance (Typeable1 f, Typeable1 w, Data a, Data (f (StreamT f w a)), Data (StreamT f w a)) => Data (Node f w a) where+  gfoldl k z (a :< as) = z (:<) `k` a `k` as+  toConstr _ = nodeConstr+  gunfold f z c = case constrIndex c of+    1 -> f (f (z (:<)))+    _ -> error "gunfold"+  dataTypeOf _ = nodeDataType+  dataCast1 f = gcast1 f++{- instance (Data1 f, Data1 w, Data a) => Data (Node f w a) where   gfoldl = gfoldl1   toConstr = toConstr1@@ -192,20 +210,22 @@     _ -> error "gunfold"   dataTypeOf1 _ = streamTDataType   dataCast1_1 f = gcast1 f+-} +{- instance (Data1 f, Data1 w, Data a) => Data (StreamT f w a) where   gfoldl = gfoldl1   toConstr = toConstr1   gunfold = gunfold1   dataTypeOf = dataTypeOf1   dataCast1 = dataCast1_1-{-+-} -- if any structure ever cried out for generic programming, this is it instance    ( Typeable1 f   , Typeable1 w-  , Data (w (a, f (StreamT f w a)))-  , Data (a, f (StreamT f w a))+  , Data (w (Node f w a))+  , Data (Node f w a)   , Data (f (StreamT f w a))   , Data a   ) => Data (StreamT f w a) where@@ -216,7 +236,6 @@         _ -> error "gunfold"     dataTypeOf _ = streamTDataType     dataCast1 f = gcast1 f--}  streamTConstr :: Constr streamTConstr = mkConstr streamTDataType "StreamT" [] Prefix
Control/Comonad/Trans/Traced.hs view
@@ -34,6 +34,7 @@ import Data.Functor.Apply import Data.Functor.Identity import Data.Monoid+import Data.Semigroup  import Data.Typeable @@ -50,20 +51,22 @@ instance Functor w => Functor (TracedT m w) where   fmap g = TracedT . fmap (g .) . runTracedT -instance (Comonad w, Monoid m) => Comonad (TracedT m w) where+instance (Extend w, Semigroup m) => Extend (TracedT m w) where+  extend f = TracedT . extend (\wf m -> f (TracedT (fmap (. (<>) m) wf))) . runTracedT++instance (Comonad w, Semigroup m, Monoid m) => Comonad (TracedT m w) where   extract (TracedT wf) = extract wf mempty-  extend f = TracedT . extend (\wf m -> f (TracedT (fmap (. mappend m) wf))) . runTracedT -instance Monoid m => ComonadTrans (TracedT m) where+instance (Semigroup m, Monoid m) => ComonadTrans (TracedT m) where   lower = fmap ($mempty) . runTracedT -instance Monoid m => ComonadHoist (TracedT m) where+instance (Semigroup m, Monoid m) => ComonadHoist (TracedT m) where   cohoist = traced . extract . runTracedT -instance (Monoid m, FunctorApply w) => FunctorApply (TracedT m w) where+instance (Apply w, Semigroup m, Monoid m) => Apply (TracedT m w) where   TracedT wf <.> TracedT wa = TracedT ((\mf ma m -> (mf m) (ma m)) <$> wf <.> wa) -instance (Monoid m, ComonadApply w) => ComonadApply (TracedT m w)+instance (ComonadApply w, Semigroup m, Monoid m) => ComonadApply (TracedT m w)  trace :: (Comonad w, Monoid m) => m -> TracedT m w a -> a trace m (TracedT wf) = extract wf m
comonad-transformers.cabal view
@@ -1,6 +1,6 @@ name:          comonad-transformers category:      Control, Comonads-version:       0.7.0+version:       0.9.0 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -22,9 +22,10 @@   build-depends:      base >= 4 && < 4.4,     array >= 0.3.0.1 && < 0.4,-    comonad >= 0.7 && < 0.8,+    comonad >= 0.9 && < 0.10,     distributive >= 0.1 && < 0.2,-    functor-apply >= 0.7.4.1 && < 0.8,+    functor-apply >= 0.9 && < 0.10,+    semigroups >= 0.3.4 && < 0.4,     prelude-extras >= 0.1 && < 0.3,     syb-extras >= 0.1 && < 0.3,     transformers >= 0.2.0 && <= 0.3