comonad-4.2.7.2: Comonads

Portabilitynon-portable (fundeps, MPTCs)
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe

Control.Comonad.Store

Contents

Description

 

Synopsis

ComonadStore class

class Comonad w => ComonadStore s w | w -> s whereSource

Methods

pos :: w a -> sSource

peek :: s -> w a -> aSource

peeks :: (s -> s) -> w a -> aSource

seek :: s -> w a -> w aSource

seeks :: (s -> s) -> w a -> w aSource

experiment :: Functor f => (s -> f s) -> w a -> f aSource

Instances

ComonadStore s w => ComonadStore s (IdentityT w) 
(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) 
ComonadStore s w => ComonadStore s (EnvT e w) 
Comonad w => ComonadStore s (StoreT s w) 

The Store comonad

type Store s = StoreT s IdentitySource

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

Create a Store using an accessor function and a stored value

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

The StoreT comonad transformer

data StoreT s w a Source

Constructors

StoreT (w (s -> a)) s 

Instances

ComonadEnv e w => ComonadEnv e (StoreT t w) 
Comonad w => ComonadStore s (StoreT s w) 
ComonadTraced m w => ComonadTraced m (StoreT s w) 
ComonadTrans (StoreT s) 
ComonadHoist (StoreT s) 
Functor w => Functor (StoreT s w) 
(Typeable s, Typeable1 w) => Typeable1 (StoreT s w) 
(Applicative w, Monoid s) => Applicative (StoreT s w) 
(ComonadApply w, Semigroup s) => ComonadApply (StoreT s w) 
Comonad w => Comonad (StoreT s w) 
(Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a) 

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

Re-exported modules