adjunctions-4.4.2: Adjunctions and representable functors
Copyright (c) Edward Kmett & Sjoerd Visscher 2011
License BSD3
Maintainer ekmett@gmail.com
Stability experimental
Safe Haskell Safe-Inferred
Language Haskell2010

Control.Comonad.Representable.Store

Description

This is a generalized Store Comonad , parameterized by a Representable Functor . The representation of that Functor serves as the index of the store.

This can be useful if the representable functor serves to memoize its contents and will be inspected often.

Synopsis

Documentation

type Store g = StoreT g Identity Source #

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

store Source #

Arguments

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

computation

-> Rep g

index

-> Store g a

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

runStore Source #

Arguments

:: Representable g
=> Store g a

a store to access

-> ( Rep g -> a, Rep g)

initial state

Unwrap a store comonad computation as a function and a current index. (The inverse of store .)

data StoreT g w a Source #

A store transformer comonad parameterized by:

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

Constructors

StoreT (w (g a)) ( Rep g)

Instances

Instances details
( ComonadEnv m w, Representable g) => ComonadEnv m ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

ask :: StoreT g w a -> m Source #

( Comonad w, Representable g, Rep g ~ s) => ComonadStore s ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

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

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

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

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

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

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

( ComonadTraced m w, Representable g) => ComonadTraced m ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

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

( Representable g, ComonadCofree f w) => ComonadCofree f ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

unwrap :: StoreT g w a -> f ( StoreT g w a) Source #

Representable g => ComonadTrans ( StoreT g) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

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

ComonadHoist ( StoreT g) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

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

( Functor w, Functor g) => Functor ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

fmap :: (a -> b) -> StoreT g w a -> StoreT g w b Source #

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

( Applicative w, Monoid ( Rep g), Representable g) => Applicative ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

( Comonad w, Representable g) => Comonad ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

( ComonadApply w, Semigroup ( Rep g), Representable g) => ComonadApply ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

( Apply w, Semigroup ( Rep g), Representable g) => Apply ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

(<.>) :: StoreT g w (a -> b) -> StoreT g w a -> StoreT g w b Source #

(.>) :: StoreT g w a -> StoreT g w b -> StoreT g w b Source #

(<.) :: StoreT g w a -> StoreT g w b -> StoreT g w a Source #

liftF2 :: (a -> b -> c) -> StoreT g w a -> StoreT g w b -> StoreT g w c Source #

( Extend w, Representable g) => Extend ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

class Comonad w => ComonadStore s (w :: Type -> Type ) | 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

Instances details
ComonadStore s w => ComonadStore s ( Cofree w)
Instance details

Defined in Control.Comonad.Cofree

( Comonad w, Representable g, Rep g ~ s) => ComonadStore s ( StoreT g w) Source #
Instance details

Defined in Control.Comonad.Representable.Store

Methods

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

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

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

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

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

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

( 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 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 #

Comonad w => ComonadStore s ( StoreT s w)
Instance details

Defined in Control.Comonad.Store.Class

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 #

ComonadStore s w => ComonadStore s ( IdentityT w)
Instance details

Defined in Control.Comonad.Store.Class

ComonadStore s w => ComonadStore s ( EnvT e w)
Instance details

Defined in Control.Comonad.Store.Class

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 #