comonad-transformers-0.6.2: Haskell 98 comonad transformers

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>

Control.Comonad.Trans.Store.Lazy

Contents

Description

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)

Thanks go to Russell O'Connor and Daniel Peebles for their help formulating and proving the laws for this comonad transformer.

Synopsis

The Store comonad

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

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

The Store comonad transformer

data StoreT s w a Source

Constructors

StoreT (w (s -> a)) s 

Instances

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

Operations

get :: StoreT s w a -> sSource

put :: Comonad w => s -> StoreT s w a -> aSource

modify :: Comonad w => (s -> s) -> StoreT s w a -> aSource

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