comonad-5.0.2: Comonads

Copyright(C) 2008-2014 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable (fundeps, MPTCs)
Safe HaskellSafe
LanguageHaskell2010

Control.Comonad.Store

Contents

Description

 

Synopsis

ComonadStore class

class Comonad w => ComonadStore s w | w -> s where Source #

Minimal complete definition

pos, peek

Methods

pos :: w a -> s Source #

peek :: s -> w a -> a Source #

peeks :: (s -> s) -> w a -> a Source #

seek :: s -> w a -> w a Source #

seeks :: (s -> s) -> w a -> w a Source #

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

Instances

(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) Source # 

Methods

pos :: TracedT m w a -> s Source #

peek :: s -> TracedT m w a -> a Source #

peeks :: (s -> s) -> TracedT m w a -> a Source #

seek :: s -> TracedT m w a -> TracedT m w a Source #

seeks :: (s -> s) -> TracedT m w a -> TracedT m w a Source #

experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a Source #

ComonadStore s w => ComonadStore s (EnvT e w) Source # 

Methods

pos :: EnvT e w a -> s Source #

peek :: s -> EnvT e w a -> a Source #

peeks :: (s -> s) -> EnvT e w a -> a Source #

seek :: s -> EnvT e w a -> EnvT e w a Source #

seeks :: (s -> s) -> EnvT e w a -> EnvT e w a Source #

experiment :: Functor f => (s -> f s) -> EnvT e w a -> f a Source #

ComonadStore s w => ComonadStore s (IdentityT * w) Source # 

Methods

pos :: IdentityT * w a -> s Source #

peek :: s -> IdentityT * w a -> a Source #

peeks :: (s -> s) -> IdentityT * w a -> a Source #

seek :: s -> IdentityT * w a -> IdentityT * w a Source #

seeks :: (s -> s) -> IdentityT * w a -> IdentityT * w a Source #

experiment :: Functor f => (s -> f s) -> IdentityT * w a -> f a Source #

Comonad w => ComonadStore s (StoreT s w) Source # 

Methods

pos :: StoreT s w a -> s Source #

peek :: s -> StoreT s w a -> a Source #

peeks :: (s -> s) -> StoreT s w a -> a Source #

seek :: s -> StoreT s w a -> StoreT s w a Source #

seeks :: (s -> s) -> StoreT s w a -> StoreT s w a Source #

experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a Source #

The Store comonad

store :: (s -> a) -> s -> Store s a Source #

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) Source # 

Methods

ask :: StoreT t w a -> e Source #

Comonad w => ComonadStore s (StoreT s w) Source # 

Methods

pos :: StoreT s w a -> s Source #

peek :: s -> StoreT s w a -> a Source #

peeks :: (s -> s) -> StoreT s w a -> a Source #

seek :: s -> StoreT s w a -> StoreT s w a Source #

seeks :: (s -> s) -> StoreT s w a -> StoreT s w a Source #

experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a Source #

ComonadTraced m w => ComonadTraced m (StoreT s w) Source # 

Methods

trace :: m -> StoreT s w a -> a Source #

ComonadHoist (StoreT s) Source # 

Methods

cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> StoreT s w a -> StoreT s v a Source #

ComonadTrans (StoreT s) Source # 

Methods

lower :: Comonad w => StoreT s w a -> w a Source #

Functor w => Functor (StoreT s w) Source # 

Methods

fmap :: (a -> b) -> StoreT s w a -> StoreT s w b #

(<$) :: a -> StoreT s w b -> StoreT s w a #

(Applicative w, Monoid s) => Applicative (StoreT s w) Source # 

Methods

pure :: a -> StoreT s w a #

(<*>) :: StoreT s w (a -> b) -> StoreT s w a -> StoreT s w b #

(*>) :: StoreT s w a -> StoreT s w b -> StoreT s w b #

(<*) :: StoreT s w a -> StoreT s w b -> StoreT s w a #

(ComonadApply w, Semigroup s) => ComonadApply (StoreT s w) Source # 

Methods

(<@>) :: StoreT s w (a -> b) -> StoreT s w a -> StoreT s w b Source #

(@>) :: StoreT s w a -> StoreT s w b -> StoreT s w b Source #

(<@) :: StoreT s w a -> StoreT s w b -> StoreT s w a Source #

Comonad w => Comonad (StoreT s w) Source # 

Methods

extract :: StoreT s w a -> a Source #

duplicate :: StoreT s w a -> StoreT s w (StoreT s w a) Source #

extend :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b Source #

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

Re-exported modules