Portability | portable |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
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.
- type Store s = StoreT s Identity
- store :: (s -> a) -> s -> Store s a
- runStore :: Store s a -> (s -> a, s)
- data StoreT s w a = StoreT (w (s -> a)) s
- runStoreT :: StoreT s w a -> (w (s -> a), s)
- get :: StoreT s w a -> s
- put :: Comonad w => s -> StoreT s w a -> a
- modify :: Comonad w => (s -> s) -> StoreT s w a -> a
- experiment :: (Comonad w, Functor f) => f (s -> s) -> StoreT s w a -> f a