packages feed

comonad-extras 0.3.0 → 0.4.0

raw patch · 3 files changed

+6/−245 lines, 3 filesdep −MemoTriedep ~basedep ~comonaddep ~comonad-transformersPVP ok

version bump matches the API change (PVP)

Dependencies removed: MemoTrie

Dependency ranges changed: base, comonad, comonad-transformers, comonads-fd

API changes (from Hackage documentation)

- Control.Comonad.Store.MemoTrie: StoreT :: (w (s :->: a)) -> s -> StoreT s w a
- Control.Comonad.Store.MemoTrie: data StoreT s w a
- Control.Comonad.Store.MemoTrie: instance (Applicative w, Semigroup s, Monoid s, HasTrie s) => Applicative (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Apply w, Semigroup s, HasTrie s) => Apply (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Comonad w, HasTrie s) => Comonad (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Comonad w, HasTrie s) => ComonadStore s (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (ComonadEnv m w, HasTrie s) => ComonadEnv m (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (ComonadTraced m w, HasTrie s) => ComonadTraced m (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Extend w, HasTrie s) => Extend (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Functor w, HasTrie s) => Functor (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w)
- Control.Comonad.Store.MemoTrie: instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a)
- Control.Comonad.Store.MemoTrie: instance ComonadHoist (StoreT s)
- Control.Comonad.Store.MemoTrie: instance HasTrie s => ComonadTrans (StoreT s)
- Control.Comonad.Store.MemoTrie: runStore :: HasTrie s => Store s a -> (s -> a, s)
- Control.Comonad.Store.MemoTrie: runStoreT :: (Functor w, HasTrie s) => StoreT s w a -> (w (s -> a), s)
- Control.Comonad.Store.MemoTrie: store :: HasTrie s => (s -> a) -> s -> Store s a
- Control.Comonad.Store.MemoTrie: storeT :: (Functor w, HasTrie s) => w (s -> a) -> s -> StoreT s w a
- Control.Comonad.Store.MemoTrie: type Store s = StoreT s Identity
- Control.Comonad.Traced.MemoTrie: TracedT :: (w (m :->: a)) -> TracedT m w a
- Control.Comonad.Traced.MemoTrie: censor :: (Functor w, HasTrie m) => (m -> m) -> TracedT m w a -> TracedT m w a
- Control.Comonad.Traced.MemoTrie: instance (Applicative w, HasTrie m) => Applicative (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Apply w, HasTrie m) => Apply (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Comonad w, Semigroup m, Monoid m, HasTrie m) => Comonad (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Comonad w, Semigroup m, Monoid m, HasTrie m) => ComonadTraced m (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (ComonadEnv e w, Semigroup m, Monoid m, HasTrie m) => ComonadEnv e (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (ComonadStore s w, Semigroup m, Monoid m, HasTrie m) => ComonadStore s (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Extend w, Semigroup m, HasTrie m) => Extend (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Functor w, HasTrie m) => Functor (TracedT m w)
- Control.Comonad.Traced.MemoTrie: instance (Semigroup m, Monoid m, HasTrie m) => ComonadHoist (TracedT m)
- Control.Comonad.Traced.MemoTrie: instance (Semigroup m, Monoid m, HasTrie m) => ComonadTrans (TracedT m)
- Control.Comonad.Traced.MemoTrie: instance (Typeable s, Typeable1 w) => Typeable1 (TracedT s w)
- Control.Comonad.Traced.MemoTrie: listen :: (Functor w, HasTrie m) => TracedT m w a -> TracedT m w (a, m)
- Control.Comonad.Traced.MemoTrie: listens :: (Functor w, HasTrie m) => (m -> b) -> TracedT m w a -> TracedT m w (a, b)
- Control.Comonad.Traced.MemoTrie: newtype TracedT m w a
- Control.Comonad.Traced.MemoTrie: runTraced :: HasTrie m => Traced m a -> m -> a
- Control.Comonad.Traced.MemoTrie: trace :: ComonadTraced m w => forall a. m -> w a -> a
- Control.Comonad.Traced.MemoTrie: traced :: HasTrie m => (m -> a) -> Traced m a
- Control.Comonad.Traced.MemoTrie: type Traced m = TracedT m Identity

Files

− Control/Comonad/Store/MemoTrie.hs
@@ -1,112 +0,0 @@-{-# LANGUAGE CPP, TypeOperators, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-}--------------------------------------------------------------------------------- |--- Module      :  Control.Comonad.Store.MemoTrie--- Copyright   :  (C) 2008-2011 Edward Kmett--- License     :  BSD-style (see the file LICENSE)------ Maintainer  :  Edward Kmett <ekmett@gmail.com>--- Stability   :  provisional--- Portability :  portable------ The trie-memoizing store (state-in-context/costate) comonad transformer is --- subject to the laws:--- --- > x = seek (pos x) x--- > y = pos (seek y x)--- > seek y x = seek y (seek z x)------ Thanks go to Russell O'Connor and Daniel Peebles for their help formulating --- and proving the laws for this comonad transformer.------------------------------------------------------------------------------module Control.Comonad.Store.MemoTrie-  ( -  -- * The Store comonad-    Store, store, runStore-  -- * The Store comonad transformer-  , StoreT(..), storeT, runStoreT-  -- * Operations-  , module Control.Comonad.Store.Class-  ) where--import Control.Applicative-import Control.Comonad-import Control.Comonad.Hoist.Class-import Control.Comonad.Trans.Class-import Control.Comonad.Store.Class-import Control.Comonad.Env.Class-import Control.Comonad.Traced.Class-import Data.Functor.Identity-import Data.Functor.Apply-import Data.MemoTrie-import Data.Semigroup-import Data.Monoid--#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.Strict.StoreT"-{-# NOINLINE storeTTyCon #-}-#endif--type Store s = StoreT s Identity--store :: HasTrie s => (s -> a) -> s -> Store s a -store f s = StoreT (Identity (trie f)) s--runStore :: HasTrie s => Store s a -> (s -> a, s)-runStore (StoreT (Identity f) s) = (untrie f, s)--data StoreT s w a = StoreT (w (s :->: a)) s--storeT :: (Functor w, HasTrie s) => w (s -> a) -> s -> StoreT s w a -storeT wf s = StoreT (trie <$> wf) s--runStoreT :: (Functor w, HasTrie s) => StoreT s w a -> (w (s -> a), s)-runStoreT (StoreT wf s) = (untrie <$> wf, s)--instance (Functor w, HasTrie s) => Functor (StoreT s w) where-  fmap f (StoreT wf s) = StoreT (fmap (fmap f) wf) s--instance (Apply w, Semigroup s, HasTrie s) => Apply (StoreT s w) where-  StoreT ff m <.> StoreT fa n = StoreT ((<*>) <$> ff <.> fa) (m <> n)--instance (Applicative w, Semigroup s, Monoid s, HasTrie s) => Applicative (StoreT s w) where-  pure a = StoreT (pure (pure a)) mempty-  StoreT ff m <*> StoreT fa n = StoreT ((<*>) <$> ff <*> fa) (m `mappend` n)--instance (Extend w, HasTrie s) => Extend (StoreT s w) where-  duplicate (StoreT wf s) = StoreT (extend (trie . StoreT) wf) s--instance (Comonad w, HasTrie s) => Comonad (StoreT s w) where-  extract (StoreT wf s) = untrie (extract wf) s--instance HasTrie s => ComonadTrans (StoreT s) where-  lower (StoreT f s) = fmap (`untrie` s) f--instance ComonadHoist (StoreT s) where-  cohoist (StoreT f s) = StoreT (Identity (extract f)) s--instance (Comonad w, HasTrie s) => ComonadStore s (StoreT s w) where-  pos (StoreT _ s) = s-  seek s (StoreT f _) = StoreT f s-  seeks f (StoreT g s) = StoreT g (f s)-  peek s (StoreT g _) = untrie (extract g) s-  peeks f (StoreT g s) = untrie (extract g) (f s)--instance (ComonadTraced m w, HasTrie s) => ComonadTraced m (StoreT s w) where-  trace m = trace m . lower--instance (ComonadEnv m w, HasTrie s) => ComonadEnv m (StoreT s w) where -  ask = ask . lower
− Control/Comonad/Traced/MemoTrie.hs
@@ -1,124 +0,0 @@-{-# LANGUAGE CPP, TypeOperators, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, UndecidableInstances #-}--------------------------------------------------------------------------------- |--- Module      :  Control.Comonad.Trans.Traced--- Copyright   :  (C) 2008-2011 Edward Kmett--- License     :  BSD-style (see the file LICENSE)------ Maintainer  :  Edward Kmett <ekmett@gmail.com>--- Stability   :  provisional--- Portability :  portable------ The trace comonad transformer (aka the cowriter or exponential comonad transformer).---------------------------------------------------------------------------------module Control.Comonad.Traced.MemoTrie-  ( -  -- * Traced comonad-    Traced-  , traced-  , runTraced-  -- * Traced comonad transformer-  , TracedT(..)-  -- * Operations-  , trace-  , listen-  , listens-  , censor-  ) where--import Control.Applicative-import Control.Monad.Instances-import Control.Comonad-import Control.Comonad.Hoist.Class-import Control.Comonad.Trans.Class-import Control.Comonad.Store.Class-import Control.Comonad.Env.Class-import Control.Comonad.Traced.Class-import Data.Functor-import Data.Functor.Apply-import Data.Functor.Identity-import Data.Monoid-import Data.Semigroup-import Data.MemoTrie--import Data.Typeable--type Traced m = TracedT m Identity--traced :: HasTrie m => (m -> a) -> Traced m a-traced = TracedT . Identity . trie--runTraced :: HasTrie m => Traced m a -> m -> a-runTraced = untrie . runIdentity . untracedT --newtype TracedT m w a = TracedT (w (m :->: a))--untracedT :: TracedT m w a -> w (m :->: a)-untracedT (TracedT wf) = wf--runTracedT :: (Functor w, HasTrie m) => TracedT m w a -> w (m -> a)-runTracedT = fmap untrie . untracedT --tracedT :: (Functor w, HasTrie m) => w (m -> a) -> TracedT m w a-tracedT = TracedT . fmap trie--instance (Functor w, HasTrie m) => Functor (TracedT m w) where-  fmap g = TracedT . fmap (fmap g) . untracedT--instance (Apply w, HasTrie m) => Apply (TracedT m w) where-  TracedT wf <.> TracedT wa = TracedT ((<*>) <$> wf <.> wa)--instance (Applicative w, HasTrie m) => Applicative (TracedT m w) where-  pure = TracedT . pure . pure-  TracedT wf <*> TracedT wa = TracedT ((<*>) <$> wf <*> wa)--instance (Extend w, Semigroup m, HasTrie m) => Extend (TracedT m w) where-  extend f = TracedT -           . extend (trie . (\wf m -> f (TracedT (inTrie (. (<>) m) <$> wf)))) -           . untracedT--instance (Comonad w, Semigroup m, Monoid m, HasTrie m) => Comonad (TracedT m w) where-  extract (TracedT wf) = untrie (extract wf) mempty--instance (Semigroup m, Monoid m, HasTrie m) => ComonadTrans (TracedT m) where-  lower = fmap (`untrie` mempty) . untracedT--instance (Semigroup m, Monoid m, HasTrie m) => ComonadHoist (TracedT m) where-  cohoist = TracedT . Identity . extract . untracedT--instance (ComonadStore s w, Semigroup m, Monoid m, HasTrie m) => ComonadStore s (TracedT m w) where-  pos = pos . lower-  peek s = peek s . lower--instance (Comonad w, Semigroup m, Monoid m, HasTrie m) => ComonadTraced m (TracedT m w) where-  trace m (TracedT wf) = untrie (extract wf) m--instance (ComonadEnv e w, Semigroup m, Monoid m, HasTrie m) => ComonadEnv e (TracedT m w) where-  ask = ask . lower ---- TODO: handle these more efficiently-listen :: (Functor w, HasTrie m) => TracedT m w a -> TracedT m w (a, m)-listen = tracedT . fmap (\f m -> (f m, m)) . runTracedT--listens :: (Functor w, HasTrie m) => (m -> b) -> TracedT m w a -> TracedT m w (a, b)-listens g = tracedT . fmap (\f m -> (f m, g m)) . runTracedT --censor :: (Functor w, HasTrie m) => (m -> m) -> TracedT m w a -> TracedT m w a-censor g = tracedT . fmap (. g) . runTracedT--#ifdef __GLASGOW_HASKELL__--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-extras.cabal view
@@ -1,6 +1,6 @@ name:          comonad-extras category:      Control, Comonads-version:       0.3.0+version:       0.4.0 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -24,16 +24,15 @@ library   build-depends:      array >= 0.3.0.2 && < 0.4,-    base >= 4 && < 4.4,+    base >= 4 && < 5,     containers >= 0.4 && < 0.5,-    comonad >= 1.1 && < 1.2,-    comonad-transformers >= 1.7 && < 1.8,-    comonads-fd >= 1.7 && < 1.8,+    comonad >= 1.1.0.1 && < 1.2,+    comonad-transformers >= 1.8 && < 1.9,+    comonads-fd >= 1.8 && < 1.9,     distributive >= 0.2 && < 0.3,     semigroupoids >= 1.2.2 && < 1.3,     semigroups >= 0.5 && < 0.6,-    transformers >= 0.2.0 && <= 0.3,-    MemoTrie >= 0.4.9 && < 0.5+    transformers >= 0.2.0 && <= 0.3    if flag(DeriveDataTypeable)     extensions: DeriveDataTypeable@@ -44,7 +43,5 @@   exposed-modules:     Control.Comonad.Store.Zipper     Control.Comonad.Store.Pointer-    Control.Comonad.Store.MemoTrie-    Control.Comonad.Traced.MemoTrie    ghc-options:      -Wall