comonad-transformers 0.6.1 → 0.6.2
raw patch · 9 files changed
+227/−2 lines, 9 files
Files
- Control/Comonad/Trans/Discont/Lazy.hs +18/−0
- Control/Comonad/Trans/Discont/Strict.hs +16/−0
- Control/Comonad/Trans/Env/Lazy.hs +44/−0
- Control/Comonad/Trans/Env/Strict.hs +44/−0
- Control/Comonad/Trans/Store/Lazy.hs +15/−0
- Control/Comonad/Trans/Store/Strict.hs +15/−0
- Control/Comonad/Trans/Stream.hs +49/−1
- Control/Comonad/Trans/Traced.hs +20/−0
- comonad-transformers.cabal +6/−1
Control/Comonad/Trans/Discont/Lazy.hs view
@@ -34,6 +34,24 @@ import Control.Comonad import Control.Comonad.Trans.Class +#ifdef GHC_TYPEABLE+import Data.Typeable++instance (Typeable s, Typeable1 w) => Typeable1 (DiscontT s w) where+ typeOf1 dswa = mkTyConApp discontTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where + s :: DiscontT s w a -> s+ s = undefined+ w :: DiscontT s w a -> w a+ w = undefined++discontTTyCon :: TyCon+discontTTyCon = mkTyCon "Control.Comonad.Trans.Discont.Lazy.DiscontT" +{-# NOINLINE discontTTyCon #-}++#endif++ type Discont s = DiscontT s Identity data DiscontT s w a = DiscontT (w s -> a) (w s)
Control/Comonad/Trans/Discont/Strict.hs view
@@ -34,6 +34,22 @@ import Control.Comonad import Control.Comonad.Trans.Class +#ifdef GHC_TYPEABLE+import Data.Typeable++instance (Typeable s, Typeable1 w) => Typeable1 (DiscontT s w) where+ typeOf1 dswa = mkTyConApp discontTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where + s :: DiscontT s w a -> s+ s = undefined+ w :: DiscontT s w a -> w a + w = undefined++discontTTyCon :: TyCon+discontTTyCon = mkTyCon "Control.Comonad.Trans.Discont.Strict.DiscontT" +{-# NOINLINE discontTTyCon #-}+#endif+ type Discont s = DiscontT s Identity data DiscontT s w a = DiscontT (w s -> a) (w s)
Control/Comonad/Trans/Env/Lazy.hs view
@@ -36,6 +36,49 @@ import Data.Functor.Identity import Data.Monoid +#ifdef GHC_TYPEABLE+import Data.Data++instance (Typeable s, Typeable1 w) => Typeable1 (EnvT s w) where+ typeOf1 dswa = mkTyConApp envTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where+ s :: EnvT s w a -> s+ s = undefined+ w :: EnvT s w a -> w a+ w = undefined++envTTyCon :: TyCon+envTTyCon = mkTyCon "Control.Comonad.Trans.Env.Lazy.EnvT"+{-# NOINLINE envTTyCon #-}++instance (Typeable s, Typeable1 w, Typeable a) => Typeable (EnvT s w a) where+ typeOf = typeOfDefault++instance+ ( Typeable e+ , Typeable1 w+ , Data e+ , Data (w a)+ , Data a+ ) => Data (EnvT e w a) where+ gfoldl f z (EnvT e wa) = z EnvT `f` e `f` wa+ toConstr _ = envTConstr+ gunfold k z c = case constrIndex c of+ 1 -> k (k (z EnvT))+ _ -> error "gunfold"+ dataTypeOf _ = envTDataType+ dataCast1 f = gcast1 f++envTConstr :: Constr+envTConstr = mkConstr envTDataType "EnvT" [] Prefix+{-# NOINLINE envTConstr #-}++envTDataType :: DataType+envTDataType = mkDataType "Control.Comonad.Trans.Env.Lazy.EnvT" [envTConstr]+{-# NOINLINE envTDataType #-}++#endif+ type Env e = EnvT e Identity data EnvT e w a = EnvT e (w a) @@ -74,3 +117,4 @@ local :: (e -> e) -> EnvT e w a -> EnvT e w a local f ~(EnvT e wa) = EnvT (f e) wa+
Control/Comonad/Trans/Env/Strict.hs view
@@ -36,6 +36,49 @@ import Data.Functor.Identity import Data.Monoid +#ifdef GHC_TYPEABLE+import Data.Data++instance (Typeable s, Typeable1 w) => Typeable1 (EnvT s w) where+ typeOf1 dswa = mkTyConApp envTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where+ s :: EnvT s w a -> s+ s = undefined+ w :: EnvT s w a -> w a+ w = undefined++envTTyCon :: TyCon+envTTyCon = mkTyCon "Control.Comonad.Trans.Env.Strict.EnvT"+{-# NOINLINE envTTyCon #-}++instance (Typeable s, Typeable1 w, Typeable a) => Typeable (EnvT s w a) where+ typeOf = typeOfDefault++instance + ( Typeable e+ , Typeable1 w+ , Data e+ , Data (w a)+ , Data a+ ) => Data (EnvT e w a) where+ gfoldl f z (EnvT e wa) = z EnvT `f` e `f` wa+ toConstr _ = envTConstr+ gunfold k z c = case constrIndex c of+ 1 -> k (k (z EnvT))+ _ -> error "gunfold"+ dataTypeOf _ = envTDataType+ dataCast1 f = gcast1 f++envTConstr :: Constr+envTConstr = mkConstr envTDataType "EnvT" [] Prefix+{-# NOINLINE envTConstr #-}++envTDataType :: DataType+envTDataType = mkDataType "Control.Comonad.Trans.Env.Strict.EnvT" [envTConstr]+{-# NOINLINE envTDataType #-}++#endif+ type Env e = EnvT e Identity data EnvT e w a = EnvT e (w a) @@ -74,3 +117,4 @@ local :: (e -> e) -> EnvT e w a -> EnvT e w a local f (EnvT e wa) = EnvT (f e) wa+
Control/Comonad/Trans/Store/Lazy.hs view
@@ -35,6 +35,21 @@ import Control.Comonad.Trans.Class import Data.Functor.Identity +#ifdef GHC_TYPEABLE+import Data.Typeable+instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w) where+ typeOf1 dswa = mkTyConApp storeTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where+ s :: StoreT s w a -> s+ s = undefined+ w :: StoreT s w a -> w a+ w = undefined++storeTTyCon :: TyCon+storeTTyCon = mkTyCon "Control.Comonad.Trans.Store.Lazy.StoreT"+{-# NOINLINE storeTTyCon #-}+#endif+ type Store s = StoreT s Identity store :: (s -> a) -> s -> Store s a
Control/Comonad/Trans/Store/Strict.hs view
@@ -35,6 +35,21 @@ import Control.Comonad.Trans.Class import Data.Functor.Identity +#ifdef GHC_TYPEABLE+import Data.Typeable+instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w) where+ typeOf1 dswa = mkTyConApp storeTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where+ s :: StoreT s w a -> s+ s = undefined+ w :: StoreT s w a -> w a+ w = undefined++storeTTyCon :: TyCon+storeTTyCon = mkTyCon "Control.Comonad.Trans.Store.Lazy.StoreT"+{-# NOINLINE storeTTyCon #-}+#endif+ type Store s = StoreT s Identity store :: (s -> a) -> s -> Store s a
Control/Comonad/Trans/Stream.hs view
@@ -1,4 +1,4 @@--- {-# LANGUAGE FlexibleContexts, UndecidableInstances #-}+{-# LANGUAGE FlexibleContexts, UndecidableInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Stream@@ -39,6 +39,10 @@ import Data.Traversable import Data.Monoid +#ifdef GHC_TYPEABLE+import Data.Data+#endif+ -- | Isomorphic to the definition: -- -- > data Stream f a = a :< f (Stream f a)@@ -103,3 +107,47 @@ unfoldsW :: (Comonad w, Functor f) => (w a -> (b, f a)) -> w a -> StreamT f w b unfoldsW f = StreamT . extend (\s -> let (h, t) = f s in (h, fmap (\a -> unfoldsW f (a <$ s)) t))++#ifdef GHC_TYPEABLE++instance (Typeable1 f, Typeable1 w) => Typeable1 (StreamT f w) where+ typeOf1 dfwa = mkTyConApp streamTTyCon [typeOf1 (f dfwa), typeOf1 (w dfwa)]+ where+ f :: StreamT f w a -> f a + f = undefined+ w :: StreamT f w a -> w a+ w = undefined++instance (Typeable1 f, Typeable1 w, Typeable a) => Typeable (StreamT f w a) where+ typeOf = typeOfDefault++streamTTyCon :: TyCon+streamTTyCon = mkTyCon "Control.Comonad.Trans.Stream.StreamT"+{-# NOINLINE streamTTyCon #-}++-- 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 (f (StreamT f w a))+ , Data a+ ) => Data (StreamT f w a) where+ gfoldl f z (StreamT a) = z StreamT `f` a+ toConstr _ = streamTConstr+ gunfold k z c = case constrIndex c of+ 1 -> k (z StreamT)+ _ -> error "gunfold"+ dataTypeOf _ = streamTDataType+ dataCast1 f = gcast1 f++streamTConstr :: Constr+streamTConstr = mkConstr streamTDataType "StreamT" [] Prefix+{-# NOINLINE streamTConstr #-}++streamTDataType :: DataType+streamTDataType = mkDataType "Control.Comonad.Trans.Stream.StreamT" [streamTConstr]+{-# NOINLINE streamTDataType #-}++#endif
Control/Comonad/Trans/Traced.hs view
@@ -35,6 +35,10 @@ import Data.Functor.Identity import Data.Monoid +#ifdef GHC_TYPEABLE+import Data.Typeable+#endif+ type Traced m = TracedT m Identity traced :: (m -> a) -> Traced m a@@ -74,3 +78,19 @@ censor :: Functor w => (m -> m) -> TracedT m w a -> TracedT m w a censor g = TracedT . fmap (. g) . runTracedT++#ifdef GHC_TYPEABLE++instance (Typeable s, Typeable1 w) => Typeable1 (TracedT s w) where+ typeOf1 dswa = mkTyConApp tracedTTyCon [typeOf (s dswa), typeOf1 (w dswa)]+ where+ s :: TracedT s w a -> s+ s = undefined+ w :: TracedT s w a -> w a+ w = undefined++tracedTTyCon :: TyCon+tracedTTyCon = mkTyCon "Control.Comonad.Trans.Traced.TracedT"+{-# NOINLINE tracedTTyCon #-}++#endif
comonad-transformers.cabal view
@@ -1,6 +1,6 @@ name: comonad-transformers category: Control, Comonads-version: 0.6.1+version: 0.6.2 license: BSD3 cabal-version: >= 1.2 license-file: LICENSE@@ -21,6 +21,11 @@ comonad >= 0.6 && < 0.7, functor-apply >= 0.6 && < 0.8, transformers >= 0.2.0 && <= 0.3++ extensions: CPP+ if impl(ghc)+ cpp-options: -DGHC_TYPEABLE+ extensions: FlexibleContexts exposed-modules: Control.Comonad.Hoist.Class