Module
Control.Comonad.Store
- Package
- purescript-transformers
- Repository
- purescript/purescript-transformers
This module defines the Store comonad.
Re-exports from Control.Comonad.Store.Class
#ComonadStore Source
class ComonadStore :: Type -> (Type -> Type) -> Constraintclass (Comonad w) <= ComonadStore s w | w -> s where
The ComonadStore type class represents those monads which support local position information via
pos and peek.
posreads the current position.peekreads the value at the specified position in the specified context.
An implementation is provided for StoreT.
Laws:
pos (extend _ x) = pos xpeek (pos x) x = extract x
For example:
blur :: forall w. (ComonadStore Number w) -> w Number -> w Number
blur = extend \r -> (peeks (\n -> n - 1) r + peeks (\n -> n + 1) r) / 2)
Members
Instances
(Comonad w) => ComonadStore s (StoreT s w)(ComonadStore s w) => ComonadStore s (EnvT e w)(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w)
#seeks Source
seeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> w aReposition the focus at the specified position, which depends on the current position.
#seek Source
seek :: forall s a w. ComonadStore s w => s -> w a -> w aReposition the focus at the specified position.
#peeks Source
peeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> aExtract a value from a position which depends on the current position.
#experiment Source
experiment :: forall f a w s. ComonadStore s w => Functor f => (s -> f s) -> w a -> f aExtract a collection of values from positions which depend on the current position.
Re-exports from Control.Comonad.Store.Trans
#StoreT Source
newtype StoreT :: Type -> (Type -> Type) -> Type -> Typenewtype StoreT s w a
The store comonad transformer.
This comonad transformer extends the context of a value in the base comonad so that the value
depends on a position of type s.
The ComonadStore type class describes the operations supported by this comonad.
Constructors
Instances
- Modules
- Control.
Comonad. Env - Control.
Comonad. Env. Class - Control.
Comonad. Env. Trans - Control.
Comonad. Store - Control.
Comonad. Store. Class - Control.
Comonad. Store. Trans - Control.
Comonad. Traced - Control.
Comonad. Traced. Class - Control.
Comonad. Traced. Trans - Control.
Comonad. Trans. Class - Control.
Monad. Cont - Control.
Monad. Cont. Class - Control.
Monad. Cont. Trans - Control.
Monad. Error. Class - Control.
Monad. Except - Control.
Monad. Except. Trans - Control.
Monad. Identity. Trans - Control.
Monad. List. Trans - Control.
Monad. Maybe. Trans - Control.
Monad. RWS - Control.
Monad. RWS. Trans - Control.
Monad. Reader - Control.
Monad. Reader. Class - Control.
Monad. Reader. Trans - Control.
Monad. State - Control.
Monad. State. Class - Control.
Monad. State. Trans - Control.
Monad. Trans. Class - Control.
Monad. Writer - Control.
Monad. Writer. Class - Control.
Monad. Writer. Trans