comonad-transformers 0.9.0 → 0.10.0
raw patch · 10 files changed
+99/−43 lines, 10 filesdep ~functor-applyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: functor-apply
API changes (from Hackage documentation)
- Control.Comonad.Trans.Env.Lazy: instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e w)
- Control.Comonad.Trans.Env.Strict: instance (Semigroup e, ComonadApply w) => ComonadApply (EnvT e 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.Traced: instance (ComonadApply w, Semigroup m, Monoid m) => ComonadApply (TracedT m w)
+ Control.Comonad.Trans.Stream: instance (Comonad w, Apply w, Apply f) => Apply (StreamT f w)
+ Data.Functor.Extend.Trans.Class: class ExtendTrans t
+ Data.Functor.Extend.Trans.Class: instance ExtendTrans IdentityT
+ Data.Functor.Extend.Trans.Class: lower :: (ExtendTrans t, Extend w) => t w a -> w a
+ Data.Functor.Extend.Trans.Maybe: MaybeT :: Maybe (w a) -> MaybeT w a
+ Data.Functor.Extend.Trans.Maybe: data MaybeT w a
+ Data.Functor.Extend.Trans.Maybe: instance Applicative w => Alternative (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: instance Applicative w => Applicative (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: instance Apply w => Alt (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: instance Apply w => Apply (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: instance Extend w => Extend (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: instance Functor w => Functor (MaybeT w)
+ Data.Functor.Extend.Trans.Maybe: justT :: w a -> MaybeT w a
+ Data.Functor.Extend.Trans.Maybe: maybeT :: a -> (w b -> a) -> MaybeT w b -> a
+ Data.Functor.Extend.Trans.Maybe: nothing :: MaybeT w a
+ Data.Functor.Extend.Trans.Maybe: runMaybeT :: MaybeT w a -> Maybe (w a)
- Control.Comonad.Trans.Class: lower :: (ComonadTrans t, Comonad w) => t w a -> w a
+ Control.Comonad.Trans.Class: lower :: (ComonadTrans t, Extend w) => t w a -> w a
Files
- Control/Comonad/Trans/Class.hs +3/−2
- Control/Comonad/Trans/Discont/Lazy.hs +0/−2
- Control/Comonad/Trans/Env/Lazy.hs +1/−4
- Control/Comonad/Trans/Env/Strict.hs +1/−4
- Control/Comonad/Trans/Identity.hs +0/−18
- Control/Comonad/Trans/Stream.hs +5/−8
- Control/Comonad/Trans/Traced.hs +0/−3
- Data/Functor/Extend/Trans/Class.hs +22/−0
- Data/Functor/Extend/Trans/Maybe.hs +62/−0
- comonad-transformers.cabal +5/−2
Control/Comonad/Trans/Class.hs view
@@ -8,13 +8,14 @@ -- Stability : provisional -- Portability : portable -----------------------------------------------------------------------------module Control.Comonad.Trans.Class (ComonadTrans(..)) where+module Control.Comonad.Trans.Class + ( ComonadTrans(..) ) where import Control.Comonad import Control.Monad.Trans.Identity class ComonadTrans t where- lower :: Comonad w => t w a -> w a + lower :: Extend w => t w a -> w a -- avoiding orphans instance ComonadTrans IdentityT where
Control/Comonad/Trans/Discont/Lazy.hs view
@@ -51,7 +51,6 @@ #endif - type Discont s = DiscontT s Identity data DiscontT s w a = DiscontT (w s -> a) (w s)@@ -78,7 +77,6 @@ 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/Env/Lazy.hs view
@@ -31,9 +31,8 @@ import Control.Applicative import Control.Comonad-import Control.Comonad.Trans.Class import Control.Comonad.Hoist.Class-import Control.Comonad.Apply+import Control.Comonad.Trans.Class import Data.Functor.Apply import Data.Functor.Identity import Data.Foldable@@ -122,8 +121,6 @@ instance (Semigroup e, Apply w) => Apply (EnvT e w) where ~(EnvT ef wf) <.> ~(EnvT ea wa) = EnvT (ef <> ea) (wf <.> wa)--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
@@ -30,9 +30,8 @@ ) where import Control.Comonad-import Control.Comonad.Apply-import Control.Comonad.Trans.Class import Control.Comonad.Hoist.Class+import Control.Comonad.Trans.Class import Data.Foldable import Data.Traversable import Data.Functor.Apply@@ -127,8 +126,6 @@ instance (Semigroup e, Apply w) => Apply (EnvT e w) where EnvT ef wf <.> EnvT ea wa = EnvT (ef <> ea) (wf <.> wa)--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/Identity.hs view
@@ -14,21 +14,3 @@ ) where import Control.Monad.Trans.Identity---- Provided by Control.Comonad to avoid an orphan-{--instance Comonad w => Comonad (IdentityT w) where- extract = extract . runIdentityT- extend f (IdentityT m) = IdentityT (extend (f . IdentityT) m)--}---- Provided by Control.Comonad.Trans.Class to avoid orphans-{--instance ComonadTrans IdentityT where- lower = IdentityT--}--{--instance ComonadHoist IdentityT where- cohoist = IdentityT . Identity . extract . runIdentityT--}
Control/Comonad/Trans/Stream.hs view
@@ -32,10 +32,9 @@ import Control.Applicative import Control.Comonad-import Control.Comonad.Apply import Control.Comonad.Hoist.Class-import Control.Comonad.Trans.Class import Data.Functor.Apply+import Control.Comonad.Trans.Class import Data.Functor.Identity import Data.Foldable import Data.Traversable@@ -44,7 +43,7 @@ import Text.Show.Extras #ifdef __GLASGOW_HASKELL__-import Data.Data.Extras+import Data.Data.Extras hiding (liftF2) #endif -- | Isomorphic to the definition:@@ -109,14 +108,12 @@ 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+instance (Comonad w, Apply w, Apply f) => Apply (StreamT f w) where+ StreamT ffs <.> StreamT aas = StreamT (liftF2 wfa ffs aas) where wfa (f :< fs) (a :< as) = f a :< ((<.>) <$> fs <.> as) -instance (ComonadApply w, Apply f) => ComonadApply (StreamT f w)- instance Functor f => ComonadTrans (StreamT f) where- lower = fmap fstN . runStreamT+ lower = fmap fstN . runStreamT instance Functor f => ComonadHoist (StreamT f) where cohoist (StreamT wa) = stream a (cohoist <$> as) where
Control/Comonad/Trans/Traced.hs view
@@ -27,7 +27,6 @@ ) where import Control.Comonad-import Control.Comonad.Apply import Control.Comonad.Hoist.Class import Control.Comonad.Trans.Class import Data.Functor@@ -65,8 +64,6 @@ 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 (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
+ Data/Functor/Extend/Trans/Class.hs view
@@ -0,0 +1,22 @@+-----------------------------------------------------------------------------+-- |+-- Module : Data.Functor.Extend.Trans.Class+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+----------------------------------------------------------------------------+module Data.Functor.Extend.Trans.Class+ ( ExtendTrans(..) ) where++import Control.Comonad+import Control.Monad.Trans.Identity++class ExtendTrans t where+ lower :: Extend w => t w a -> w a ++-- avoiding orphans+instance ExtendTrans IdentityT where+ lower = runIdentityT
+ Data/Functor/Extend/Trans/Maybe.hs view
@@ -0,0 +1,62 @@+-----------------------------------------------------------------------------+-- |+-- Module : Data.Functor.Extend.Trans.Maybe+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+----------------------------------------------------------------------------+module Data.Functor.Extend.Trans.Maybe+ ( MaybeT(..), maybeT, nothing, justT ) where++import Control.Applicative+import Data.Functor.Apply+import Data.Functor.Alt+import Data.Functor.Extend+-- import Data.Functor.Extend.Trans.Class++{-+type Maybe = MaybeT Identity+maybe :: a -> (b -> a) -> Maybe a b+just :: a -> Maybe a+-}++data MaybeT w a = MaybeT { runMaybeT :: Maybe (w a) }++instance Functor w => Functor (MaybeT w) where+ fmap f = MaybeT . fmap (fmap f) . runMaybeT++instance Extend w => Extend (MaybeT w) where+ duplicate (MaybeT (Just w)) = MaybeT $ Just $ extend (MaybeT . Just) w+ duplicate (MaybeT Nothing) = MaybeT Nothing++{-+instance ExtendHoist MaybeT where+ cohoistE (MaybeT m) = MaybeT $ fmap (Identity . extract) m+-}+ +maybeT :: a -> (w b -> a) -> MaybeT w b -> a+maybeT z f = maybe z f . runMaybeT ++nothing :: MaybeT w a +nothing = MaybeT Nothing++justT :: w a -> MaybeT w a +justT = MaybeT . Just++instance Apply w => Apply (MaybeT w) where+ MaybeT a <.> MaybeT b = MaybeT $ (<.>) <$> a <.> b++instance Applicative w => Applicative (MaybeT w) where+ pure = MaybeT . Just . pure+ MaybeT a <*> MaybeT b = MaybeT $ (<*>) <$> a <*> b++-- TODO: weaken Alt+instance Apply w => Alt (MaybeT w) where+ MaybeT a <!> MaybeT b = MaybeT $ a <!> b++instance Applicative w => Alternative (MaybeT w) where+ empty = MaybeT Nothing+ MaybeT a <|> MaybeT b = MaybeT $ a <|> b
comonad-transformers.cabal view
@@ -1,6 +1,6 @@ name: comonad-transformers category: Control, Comonads-version: 0.9.0+version: 0.10.0 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -24,7 +24,7 @@ array >= 0.3.0.1 && < 0.4, comonad >= 0.9 && < 0.10, distributive >= 0.1 && < 0.2,- functor-apply >= 0.9 && < 0.10,+ functor-apply >= 0.10.0 && < 0.11, semigroups >= 0.3.4 && < 0.4, prelude-extras >= 0.1 && < 0.3, syb-extras >= 0.1 && < 0.3,@@ -51,5 +51,8 @@ Control.Comonad.Trans.Store.Strict Control.Comonad.Trans.Traced Control.Comonad.Trans.Stream+ Data.Functor.Extend.Trans.Class+ Data.Functor.Extend.Trans.Maybe ghc-options: -Wall +