comonad-transformers 1.0.0 → 1.0.1
raw patch · 9 files changed
+450/−10 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Comonad.Trans.Discont.Memo.Lazy: callCV :: DiscontT s w (DiscontT s w (DiscontT s w a -> a) -> b) -> b
+ Control.Comonad.Trans.Discont.Memo.Lazy: data DiscontT s w a
+ Control.Comonad.Trans.Discont.Memo.Lazy: discont :: (s -> a) -> s -> Discont s a
+ Control.Comonad.Trans.Discont.Memo.Lazy: discontT :: (w s -> a) -> w s -> DiscontT s w a
+ Control.Comonad.Trans.Discont.Memo.Lazy: instance (Typeable s, Typeable1 w) => Typeable1 (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Lazy: instance Comonad (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Lazy: instance ComonadTrans (DiscontT s)
+ Control.Comonad.Trans.Discont.Memo.Lazy: instance Extend (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Lazy: instance Functor (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Lazy: label :: Comonad w => DiscontT s w a -> s
+ Control.Comonad.Trans.Discont.Memo.Lazy: runDiscont :: Discont s a -> (s -> a, s)
+ Control.Comonad.Trans.Discont.Memo.Lazy: runDiscontT :: DiscontT s w a -> (w s -> a, w s)
+ Control.Comonad.Trans.Discont.Memo.Lazy: type Discont s = DiscontT s Identity
+ Control.Comonad.Trans.Discont.Memo.Strict: callCV :: DiscontT s w (DiscontT s w (DiscontT s w a -> a) -> b) -> b
+ Control.Comonad.Trans.Discont.Memo.Strict: data DiscontT s w a
+ Control.Comonad.Trans.Discont.Memo.Strict: discont :: (s -> a) -> s -> Discont s a
+ Control.Comonad.Trans.Discont.Memo.Strict: discontT :: (w s -> a) -> w s -> DiscontT s w a
+ Control.Comonad.Trans.Discont.Memo.Strict: instance (Typeable s, Typeable1 w) => Typeable1 (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Strict: instance Comonad (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Strict: instance ComonadTrans (DiscontT s)
+ Control.Comonad.Trans.Discont.Memo.Strict: instance Extend (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Strict: instance Functor (DiscontT s w)
+ Control.Comonad.Trans.Discont.Memo.Strict: label :: Comonad w => DiscontT s w a -> s
+ Control.Comonad.Trans.Discont.Memo.Strict: runDiscont :: Discont s a -> (s -> a, s)
+ Control.Comonad.Trans.Discont.Memo.Strict: runDiscontT :: DiscontT s w a -> (w s -> a, w s)
+ Control.Comonad.Trans.Discont.Memo.Strict: type Discont s = DiscontT s Identity
+ Control.Comonad.Trans.Store.Memo.Lazy: data StoreT s w a
+ Control.Comonad.Trans.Store.Memo.Lazy: experiment :: (Comonad w, Functor f) => f (s -> s) -> StoreT s w a -> f a
+ Control.Comonad.Trans.Store.Memo.Lazy: get :: StoreT s w a -> s
+ Control.Comonad.Trans.Store.Memo.Lazy: instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance Comonad w => Comonad (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance ComonadHoist (StoreT s)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance ComonadTrans (StoreT s)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance Extend w => Extend (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Lazy: instance Functor w => Functor (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Lazy: modify :: Comonad w => (s -> s) -> StoreT s w a -> a
+ Control.Comonad.Trans.Store.Memo.Lazy: put :: Comonad w => s -> StoreT s w a -> a
+ Control.Comonad.Trans.Store.Memo.Lazy: runStore :: Store s a -> (s -> a, s)
+ Control.Comonad.Trans.Store.Memo.Lazy: runStoreT :: StoreT s w a -> (w (s -> a), s)
+ Control.Comonad.Trans.Store.Memo.Lazy: store :: (s -> a) -> s -> Store s a
+ Control.Comonad.Trans.Store.Memo.Lazy: storeT :: Functor w => w (s -> a) -> s -> StoreT s w a
+ Control.Comonad.Trans.Store.Memo.Lazy: type Store s = StoreT s Identity
+ Control.Comonad.Trans.Store.Memo.Strict: data StoreT s w a
+ Control.Comonad.Trans.Store.Memo.Strict: experiment :: (Comonad w, Functor f) => f (s -> s) -> StoreT s w a -> f a
+ Control.Comonad.Trans.Store.Memo.Strict: get :: StoreT s w a -> s
+ Control.Comonad.Trans.Store.Memo.Strict: instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Strict: instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a)
+ Control.Comonad.Trans.Store.Memo.Strict: instance Comonad w => Comonad (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Strict: instance ComonadHoist (StoreT s)
+ Control.Comonad.Trans.Store.Memo.Strict: instance ComonadTrans (StoreT s)
+ Control.Comonad.Trans.Store.Memo.Strict: instance Extend w => Extend (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Strict: instance Functor w => Functor (StoreT s w)
+ Control.Comonad.Trans.Store.Memo.Strict: modify :: Comonad w => (s -> s) -> StoreT s w a -> a
+ Control.Comonad.Trans.Store.Memo.Strict: put :: Comonad w => s -> StoreT s w a -> a
+ Control.Comonad.Trans.Store.Memo.Strict: runStore :: Store s a -> (s -> a, s)
+ Control.Comonad.Trans.Store.Memo.Strict: runStoreT :: StoreT s w a -> (w (s -> a), s)
+ Control.Comonad.Trans.Store.Memo.Strict: store :: (s -> a) -> s -> Store s a
+ Control.Comonad.Trans.Store.Memo.Strict: storeT :: Functor w => w (s -> a) -> s -> StoreT s w a
+ Control.Comonad.Trans.Store.Memo.Strict: type Store s = StoreT s Identity
Files
- Control/Comonad/Trans/Discont/Lazy.hs +5/−4
- Control/Comonad/Trans/Discont/Memo.hs +20/−0
- Control/Comonad/Trans/Discont/Memo/Lazy.hs +94/−0
- Control/Comonad/Trans/Discont/Memo/Strict.hs +94/−0
- Control/Comonad/Trans/Discont/Strict.hs +5/−5
- Control/Comonad/Trans/Store/Memo.hs +21/−0
- Control/Comonad/Trans/Store/Memo/Lazy.hs +102/−0
- Control/Comonad/Trans/Store/Memo/Strict.hs +102/−0
- comonad-transformers.cabal +7/−1
Control/Comonad/Trans/Discont/Lazy.hs view
@@ -9,11 +9,12 @@ -- Stability : provisional -- Portability : portable -- --- Discont is the Density comonad of a constant functor, just as Cont is a --- Codensity monad of a constant functor.+-- 'Discont' is the density comonad of a constant functor, just as 'Cont' is a +-- Codensity monad of a constant functor. (For the definition of Density and+-- Codensity, see the non-Haskell 98 'adjunctions' package) ----- Note that Discont and Context are isomorphic, but DiscontT and ContextT are--- not.+-- Note that while 'Discont' and 'Store' are isomorphic, 'DiscontT' and 'StoreT' +-- are not. -- ---------------------------------------------------------------------------- module Control.Comonad.Trans.Discont.Lazy
+ Control/Comonad/Trans/Discont/Memo.hs view
@@ -0,0 +1,20 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Discont.Memo+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+--+-- The memoizing discontinuation comonad transformer.+-- This version is lazy; for a strict version, see+-- "Control.Comonad.Trans.Discont.Strict", which has the same interface.+--+----------------------------------------------------------------------------+module Control.Comonad.Trans.Discont.Memo+ ( module Control.Comonad.Trans.Discont.Memo.Lazy+ ) where++import Control.Comonad.Trans.Discont.Memo.Lazy
+ Control/Comonad/Trans/Discont/Memo/Lazy.hs view
@@ -0,0 +1,94 @@+{-# LANGUAGE CPP, RankNTypes #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Discont.Memo.Lazy+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+-- +--+-- 'Discont' is the density comonad of a constant functor, just as 'Cont' is a +-- Codensity monad of a constant functor. (For the definition of Density and+-- Codensity, see the non-Haskell 98 'adjunctions' package)+--+-- Note that while 'Discont' and 'Store' are isomorphic, 'DiscontT' and 'StoreT' +-- are not.+--+-- Like the memoizing store comonad, version memoizes the result of applying +-- the continuation to the current context. +--+----------------------------------------------------------------------------+module Control.Comonad.Trans.Discont.Memo.Lazy+ ( + -- * The 'discontinuation' comonad+ Discont+ , discont+ -- * The discontinuation comonad transformer+ , runDiscont+ , DiscontT+ , discontT + , runDiscontT+ -- * Combinators+ , callCV+ , label+ ) where++import Data.Functor.Identity+import Control.Comonad+import Control.Comonad.Trans.Class++#ifdef __GLASGOW_HASKELL__+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.Memo.Lazy.DiscontT" +{-# NOINLINE discontTTyCon #-}++#endif++type Discont s = DiscontT s Identity++data DiscontT s w a = DiscontT (w s -> a) (w s) a++discont :: (s -> a) -> s -> Discont s a +discont f s = DiscontT (f . runIdentity) (Identity s) (f s)++discontT :: (w s -> a) -> w s -> DiscontT s w a +discontT f s = DiscontT f s (f s)++runDiscont :: Discont s a -> (s -> a, s) +runDiscont ~(DiscontT f (Identity s) _) = (f . Identity, s)++runDiscontT :: DiscontT s w a -> (w s -> a, w s)+runDiscontT ~(DiscontT f s _) = (f, s)++instance Functor (DiscontT s w) where+ fmap g ~(DiscontT f ws a) = DiscontT (g . f) ws (g a)++instance Extend (DiscontT s w) where+ duplicate ~(DiscontT f ws _) = discontT (discontT f) ws++instance Comonad (DiscontT s w) where+ extract ~(DiscontT _ _ a) = a++instance ComonadTrans (DiscontT s) where+ lower ~(DiscontT f s _) = extend f s++-- instance Apply w => Apply (DiscontT s w) where++label :: Comonad w => DiscontT s w a -> s +label ~(DiscontT _ ws _) = extract ws++callCV :: DiscontT s w (DiscontT s w (DiscontT s w a -> a) -> b) -> b+callCV ~(DiscontT k s _) = k s (discontT (\s' ~(DiscontT k' _ _) -> k' s') s)
+ Control/Comonad/Trans/Discont/Memo/Strict.hs view
@@ -0,0 +1,94 @@+{-# LANGUAGE CPP, RankNTypes #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Discont.Memo.Strict+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+-- +--+-- 'Discont' is the density comonad of a constant functor, just as 'Cont' is a +-- Codensity monad of a constant functor. (For the definition of Density and+-- Codensity, see the non-Haskell 98 'adjunctions' package)+--+-- Note that while 'Discont' and 'Store' are isomorphic, 'DiscontT' and 'StoreT' +-- are not.+--+-- Like the memoizing store comonad, version memoizes the result of applying +-- the continuation to the current context. +--+----------------------------------------------------------------------------+module Control.Comonad.Trans.Discont.Memo.Strict+ ( + -- * The 'discontinuation' comonad+ Discont+ , discont+ -- * The discontinuation comonad transformer+ , runDiscont+ , DiscontT+ , discontT + , runDiscontT+ -- * Combinators+ , callCV+ , label+ ) where++import Data.Functor.Identity+import Control.Comonad+import Control.Comonad.Trans.Class++#ifdef __GLASGOW_HASKELL__+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.Memo.Strict.DiscontT" +{-# NOINLINE discontTTyCon #-}++#endif++type Discont s = DiscontT s Identity++data DiscontT s w a = DiscontT (w s -> a) (w s) a++discont :: (s -> a) -> s -> Discont s a +discont f s = DiscontT (f . runIdentity) (Identity s) (f s)++discontT :: (w s -> a) -> w s -> DiscontT s w a +discontT f s = DiscontT f s (f s)++runDiscont :: Discont s a -> (s -> a, s) +runDiscont (DiscontT f (Identity s) _) = (f . Identity, s)++runDiscontT :: DiscontT s w a -> (w s -> a, w s)+runDiscontT (DiscontT f s _) = (f, s)++instance Functor (DiscontT s w) where+ fmap g (DiscontT f ws a) = DiscontT (g . f) ws (g a)++instance Extend (DiscontT s w) where+ duplicate (DiscontT f ws _) = discontT (discontT f) ws++instance Comonad (DiscontT s w) where+ extract (DiscontT _ _ a) = a++instance ComonadTrans (DiscontT s) where+ lower (DiscontT f s _) = extend f s++-- instance Apply w => Apply (DiscontT s w) where++label :: Comonad w => DiscontT s w a -> s +label (DiscontT _ ws _) = extract ws++callCV :: DiscontT s w (DiscontT s w (DiscontT s w a -> a) -> b) -> b+callCV (DiscontT k s _) = k s (discontT (\s' (DiscontT k' _ _) -> k' s') s)
Control/Comonad/Trans/Discont/Strict.hs view
@@ -8,13 +8,13 @@ -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable--- --- Discont is the Density comonad of a constant functor, just as Cont is a --- Codensity monad of a constant functor. ----- Note that Discont and Context are isomorphic, but DiscontT and ContextT are--- not.+-- 'Discont' is the density comonad of a constant functor, just as 'Cont' is a +-- Codensity monad of a constant functor. (For the definition of Density and+-- Codensity, see the non-Haskell 98 'adjunctions' package) --+-- Note that while 'Discont' and 'Store' are isomorphic, 'DiscontT' and 'StoreT' +-- are not. ---------------------------------------------------------------------------- module Control.Comonad.Trans.Discont.Strict (
+ Control/Comonad/Trans/Store/Memo.hs view
@@ -0,0 +1,21 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Store.Memo+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+--+-- The memoized store comonad transformer (aka costate).+--+-- This version is lazy; for a strict version, see+-- "Control.Comonad.Trans.Store.Memo.Strict", which has the same interface.+--+----------------------------------------------------------------------------+module Control.Comonad.Trans.Store.Memo+ ( module Control.Comonad.Trans.Store.Memo.Lazy+ ) where++import Control.Comonad.Trans.Store.Memo.Lazy
+ Control/Comonad/Trans/Store/Memo/Lazy.hs view
@@ -0,0 +1,102 @@+{-# LANGUAGE CPP #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Store.Memo.Lazy+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+--+-- The lazy store (state-in-context/costate) comonad transformer is subject to the laws:+-- +-- > x = put (get x) x+-- > y = get (put y x)+-- > put y x = put y (put z x)+--+-- This version of the transformer lazily memoizes the result of applying the +-- comonad to the current state. This can be useful for avoiding redundant +-- computation if you reuse the same StoreT object multiple times.+----------------------------------------------------------------------------+module Control.Comonad.Trans.Store.Memo.Lazy+ ( + -- * The Store comonad+ Store, store, runStore+ -- * The Store comonad transformer+ , StoreT, storeT, runStoreT+ -- * Operations+ , get+ , put+ , modify+ , experiment+ ) where++import Control.Comonad+import Control.Comonad.Hoist.Class+import Control.Comonad.Trans.Class+import Data.Functor.Identity++#ifdef __GLASGOW_HASKELL__+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++instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a) where+ typeOf = typeOfDefault++storeTTyCon :: TyCon+storeTTyCon = mkTyCon "Control.Comonad.Trans.Store.Memo.Lazy.StoreT"+{-# NOINLINE storeTTyCon #-}+#endif++type Store s = StoreT s Identity++store :: (s -> a) -> s -> Store s a +store f s = StoreT (Identity f) s (Identity (f s))++runStore :: Store s a -> (s -> a, s)+runStore ~(StoreT (Identity f) s _) = (f, s)++-- inhabitants of @StoreT wf s w@ ensure that+--+-- > w = ($s) <$> wf+data StoreT s w a = StoreT (w (s -> a)) s (w a)++runStoreT :: StoreT s w a -> (w (s -> a), s)+runStoreT ~(StoreT wf s _) = (wf, s)++storeT :: Functor w => w (s -> a) -> s -> StoreT s w a+storeT wf s = StoreT wf s (fmap ($s) wf)++instance Functor w => Functor (StoreT s w) where+ fmap f ~(StoreT wf s w) = StoreT (fmap (f .) wf) s (fmap f w)++instance Extend w => Extend (StoreT s w) where+ duplicate ~(StoreT wf s _) = storeT (extend storeT wf) s ++instance Comonad w => Comonad (StoreT s w) where+ extract ~(StoreT _ _ w) = extract w++instance ComonadTrans (StoreT s) where+ lower ~(StoreT _ _ w) = w++instance ComonadHoist (StoreT s) where+ cohoist ~(StoreT f s w) = StoreT (Identity (extract f)) s (Identity (extract w))++get :: StoreT s w a -> s+get ~(StoreT _ s _) = s++put :: Comonad w => s -> StoreT s w a -> a +put s ~(StoreT f _ _) = extract f s++modify :: Comonad w => (s -> s) -> StoreT s w a -> a+modify f ~(StoreT g s _) = extract g (f s)++experiment :: (Comonad w, Functor f) => f (s -> s) -> StoreT s w a -> f a+experiment fs ~(StoreT g s _) = fmap (\f -> extract g (f s)) fs
+ Control/Comonad/Trans/Store/Memo/Strict.hs view
@@ -0,0 +1,102 @@+{-# LANGUAGE CPP #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Trans.Store.Memo.Strict+-- Copyright : (C) 2008-2011 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : provisional+-- Portability : portable+--+-- The lazy store (state-in-context/costate) comonad transformer is subject to the laws:+-- +-- > x = put (get x) x+-- > y = get (put y x)+-- > put y x = put y (put z x)+--+-- This version of the transformer lazily memoizes the result of applying the +-- comonad to the current state. This can be useful for avoiding redundant +-- computation if you reuse the same StoreT object multiple times.+----------------------------------------------------------------------------+module Control.Comonad.Trans.Store.Memo.Strict+ ( + -- * The Store comonad+ Store, store, runStore+ -- * The Store comonad transformer+ , StoreT, storeT, runStoreT+ -- * Operations+ , get+ , put+ , modify+ , experiment+ ) where++import Control.Comonad+import Control.Comonad.Hoist.Class+import Control.Comonad.Trans.Class+import Data.Functor.Identity++#ifdef __GLASGOW_HASKELL__+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++instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a) where+ typeOf = typeOfDefault++storeTTyCon :: TyCon+storeTTyCon = mkTyCon "Control.Comonad.Trans.Store.Memo.Strict.StoreT"+{-# NOINLINE storeTTyCon #-}+#endif++type Store s = StoreT s Identity++store :: (s -> a) -> s -> Store s a +store f s = StoreT (Identity f) s (Identity (f s))++runStore :: Store s a -> (s -> a, s)+runStore (StoreT (Identity f) s _) = (f, s)++-- inhabitants of @StoreT wf s w@ ensure that+--+-- > w = ($s) <$> wf+data StoreT s w a = StoreT (w (s -> a)) s (w a)++runStoreT :: StoreT s w a -> (w (s -> a), s)+runStoreT (StoreT wf s _) = (wf, s)++storeT :: Functor w => w (s -> a) -> s -> StoreT s w a+storeT wf s = StoreT wf s (fmap ($s) wf)++instance Functor w => Functor (StoreT s w) where+ fmap f (StoreT wf s w) = StoreT (fmap (f .) wf) s (fmap f w)++instance Extend w => Extend (StoreT s w) where+ duplicate (StoreT wf s _) = storeT (extend storeT wf) s ++instance Comonad w => Comonad (StoreT s w) where+ extract (StoreT _ _ w) = extract w++instance ComonadTrans (StoreT s) where+ lower (StoreT _ _ w) = w++instance ComonadHoist (StoreT s) where+ cohoist (StoreT f s w) = StoreT (Identity (extract f)) s (Identity (extract w))++get :: StoreT s w a -> s+get (StoreT _ s _) = s++put :: Comonad w => s -> StoreT s w a -> a +put s (StoreT f _ _) = extract f s++modify :: Comonad w => (s -> s) -> StoreT s w a -> a+modify f (StoreT g s _) = extract g (f s)++experiment :: (Comonad w, Functor f) => f (s -> s) -> StoreT s w a -> f a+experiment fs (StoreT g s _) = fmap (\f -> extract g (f s)) fs
comonad-transformers.cabal view
@@ -1,6 +1,6 @@ name: comonad-transformers category: Control, Comonads-version: 1.0.0+version: 1.0.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -44,6 +44,9 @@ Control.Comonad.Trans.Discont Control.Comonad.Trans.Discont.Lazy Control.Comonad.Trans.Discont.Strict+ Control.Comonad.Trans.Discont.Memo+ Control.Comonad.Trans.Discont.Memo.Lazy+ Control.Comonad.Trans.Discont.Memo.Strict Control.Comonad.Trans.Env Control.Comonad.Trans.Env.Lazy Control.Comonad.Trans.Env.Strict@@ -51,6 +54,9 @@ Control.Comonad.Trans.Store Control.Comonad.Trans.Store.Lazy Control.Comonad.Trans.Store.Strict+ Control.Comonad.Trans.Store.Memo+ Control.Comonad.Trans.Store.Memo.Lazy+ Control.Comonad.Trans.Store.Memo.Strict Control.Comonad.Trans.Traced Control.Comonad.Trans.Stream Data.Functor.Coproduct