Control.Comonad.Store

comonad-5.0.9: Comonads

Copyright | (C) 2008-2014 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable (fundeps, MPTCs)
Safe Haskell | Safe
Language | Haskell2010

Control.Comonad.Store

Contents

- ComonadStore class
- The Store comonad
- The StoreT comonad transformer
- Re-exported modules

Description

Synopsis

- class Comonad w => ComonadStore s (w :: Type -> Type) | w -> s where
  - pos :: w a -> s
  - peek :: s -> w a -> a
  - peeks :: (s -> s) -> w a -> a
  - seek :: s -> w a -> w a
  - seeks :: (s -> s) -> w a -> w a
  - experiment :: Functor f => (s -> f s) -> w a -> f a
- type Store s = StoreT s Identity
- store :: (s -> a) -> s -> Store s a
- runStore :: Store s a -> (s -> a, s)
- data StoreT s (w :: Type -> Type) a = StoreT (w (s -> a)) s
- runStoreT :: StoreT s w a -> (w (s -> a), s)
- module Control.Comonad
- module Control.Comonad.Trans.Class

# ComonadStore class

class Comonad w => ComonadStore s (w :: Type -> Type) | w -> s where #

Minimal complete definition

pos, peek

Methods

pos :: w a -> s #

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

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

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

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

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

#### Instances

Instances details

ComonadStore s w => ComonadStore s (EnvT e w) # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: EnvT e w a -> s # peek :: s -> EnvT e w a -> a # peeks :: (s -> s) -> EnvT e w a -> a # seek :: s -> EnvT e w a -> EnvT e w a # seeks :: (s -> s) -> EnvT e w a -> EnvT e w a # experiment :: Functor f => (s -> f s) -> EnvT e w a -> f a #
Comonad w => ComonadStore s (StoreT s w) # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: StoreT s w a -> s # peek :: s -> StoreT s w a -> a # peeks :: (s -> s) -> StoreT s w a -> a # seek :: s -> StoreT s w a -> StoreT s w a # seeks :: (s -> s) -> StoreT s w a -> StoreT s w a # experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a #
(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: TracedT m w a -> s # peek :: s -> TracedT m w a -> a # peeks :: (s -> s) -> TracedT m w a -> a # seek :: s -> TracedT m w a -> TracedT m w a # seeks :: (s -> s) -> TracedT m w a -> TracedT m w a # experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a #
ComonadStore s w => ComonadStore s (IdentityT w) # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: IdentityT w a -> s # peek :: s -> IdentityT w a -> a # peeks :: (s -> s) -> IdentityT w a -> a # seek :: s -> IdentityT w a -> IdentityT w a # seeks :: (s -> s) -> IdentityT w a -> IdentityT w a # experiment :: Functor f => (s -> f s) -> IdentityT w a -> f a #

# The Store comonad

type Store s = StoreT s Identity #

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

Create a Store using an accessor function and a stored value

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

# The StoreT comonad transformer

data StoreT s (w :: Type -> Type) a #

Constructors

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

#### Instances

Instances details

ComonadEnv e w => ComonadEnv e (StoreT t w) # |
Instance details Defined in Control.Comonad.Env.Class Methods ask :: StoreT t w a -> e #
Comonad w => ComonadStore s (StoreT s w) # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: StoreT s w a -> s # peek :: s -> StoreT s w a -> a # peeks :: (s -> s) -> StoreT s w a -> a # seek :: s -> StoreT s w a -> StoreT s w a # seeks :: (s -> s) -> StoreT s w a -> StoreT s w a # experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a #
ComonadTraced m w => ComonadTraced m (StoreT s w) # |
Instance details Defined in Control.Comonad.Traced.Class Methods trace :: m -> StoreT s w a -> a #
ComonadHoist (StoreT s) # |
Instance details Defined in Control.Comonad.Trans.Store Methods cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> StoreT s w a -> StoreT s v a #
ComonadTrans (StoreT s) # |
Instance details Defined in Control.Comonad.Trans.Store Methods lower :: Comonad w => StoreT s w a -> w a #
Comonad w => Comonad (StoreT s w) # |
Instance details Defined in Control.Comonad.Trans.Store Methods extract :: StoreT s w a -> a # duplicate :: StoreT s w a -> StoreT s w (StoreT s w a) # extend :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b #
(ComonadApply w, Semigroup s) => ComonadApply (StoreT s w) # |
Instance details Defined in Control.Comonad.Trans.Store Methods (<@>) :: 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 #
(Applicative w, Monoid s) => Applicative (StoreT s w) # |
Instance details Defined in Control.Comonad.Trans.Store Methods pure :: a -> StoreT s w a # (<*>) :: StoreT s w (a -> b) -> StoreT s w a -> StoreT s w b # liftA2 :: (a -> b -> c) -> StoreT s w a -> StoreT s w b -> StoreT s w c # (*>) :: StoreT s w a -> StoreT s w b -> StoreT s w b # (<*) :: StoreT s w a -> StoreT s w b -> StoreT s w a #
Functor w => Functor (StoreT s w) # |
Instance details Defined in Control.Comonad.Trans.Store Methods fmap :: (a -> b) -> StoreT s w a -> StoreT s w b # (<$) :: a -> StoreT s w b -> StoreT s w a #

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

# Re-exported modules

module Control.Comonad

module Control.Comonad.Trans.Class