comonad-extras-0.2.1: Comonad transformers requiring extensions to Haskell 98

MaintainerEdward Kmett <>




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.


The Store comonad

store :: HasTrie s => (s -> a) -> s -> Store s aSource

runStore :: HasTrie s => Store s a -> (s -> a, s)Source

The Store comonad transformer

data StoreT s w a Source


StoreT (w (s :->: a)) s 


(ComonadEnv m w, HasTrie s) => ComonadEnv m (StoreT s w) 
(Comonad w, HasTrie s) => ComonadStore s (StoreT s w) 
(ComonadTraced m w, HasTrie s) => ComonadTraced m (StoreT s w) 
ComonadHoist (StoreT s) 
HasTrie s => ComonadTrans (StoreT s) 
(Functor w, HasTrie s) => Functor (StoreT s w) 
(Typeable s, Typeable1 w) => Typeable1 (StoreT s w) 
(Applicative w, Semigroup s, Monoid s, HasTrie s) => Applicative (StoreT s w) 
(Comonad w, HasTrie s) => Comonad (StoreT s w) 
(Extend w, HasTrie s) => Extend (StoreT s w) 
(Apply w, Semigroup s, HasTrie s) => Apply (StoreT s w) 
(Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a) 

storeT :: (Functor w, HasTrie s) => w (s -> a) -> s -> StoreT s w aSource

runStoreT :: (Functor w, HasTrie s) => StoreT s w a -> (w (s -> a), s)Source