representable-functors-3.0: Representable functors

Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellSafe-Infered

Control.Comonad.Representable.Store

Description

A generalized Store comonad, parameterized by a Representable functor. The representation of that functor serves as the index of the store.

Synopsis

Documentation

type Store g = StoreT g IdentitySource

A memoized store comonad parameterized by a representable functor g, where the representatation of g, Key g is the index of the store.

storeSource

Arguments

:: Representable g 
=> (Key g -> a)

computation

-> Key g

index

-> Store g a 

Construct a store comonad computation from a function and a current index. (The inverse of runStore.)

runStoreSource

Arguments

:: Indexable g 
=> Store g a

a store to access

-> (Key g -> a, Key g)

initial state

Unwrap a state monad computation as a function. (The inverse of state.)

data StoreT g w a Source

A store transformer comonad parameterized by:

  • g - A representable functor used to memoize results for an index Key g
  • w - The inner comonad.

Constructors

StoreT (w (g a)) (Key g) 

storeT :: (Functor w, Representable g) => w (Key g -> a) -> Key g -> StoreT g w aSource

runStoreT :: (Functor w, Indexable g) => StoreT g w a -> (w (Key g -> a), Key g)Source

pos :: ComonadStore s w => forall a. w a -> s

peek :: ComonadStore s w => forall a. s -> w a -> a

peeks :: ComonadStore s w => forall a. (s -> s) -> w a -> a

seek :: ComonadStore s w => forall a. s -> w a -> w a

seeks :: ComonadStore s w => forall a. (s -> s) -> w a -> w a