comonad-5.0.8: 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.Env

Description

The Env comonad (aka the Coreader, Environment, or Product comonad)

A co-Kleisli arrow in the Env comonad is isomorphic to a Kleisli arrow in the reader monad.

(a -> e -> m) ~ (a, e) -> m ~ Env e a -> m

Synopsis

ComonadEnv class

class Comonad w => ComonadEnv e w | w -> e where Source #

Methods

ask :: w a -> e Source #

Instances

Instances details
ComonadEnv e (Arg e) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: Arg e a -> e Source #

ComonadEnv e ((,) e) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: (e, a) -> e Source #

Comonad w => ComonadEnv e (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: EnvT e w a -> e Source #

ComonadEnv e w => ComonadEnv e (StoreT t w) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

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

(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: TracedT m w a -> e Source #

ComonadEnv e w => ComonadEnv e (IdentityT w) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: IdentityT w a -> e Source #

asks :: ComonadEnv e w => (e -> e') -> w a -> e' Source #

local :: (e -> e') -> EnvT e w a -> EnvT e' w a Source #

Modifies the environment using the specified function.

The Env comonad

type Env e = EnvT e Identity Source #

env :: e -> a -> Env e a Source #

Create an Env using an environment and a value

runEnv :: Env e a -> (e, a) Source #

The EnvT comonad transformer

data EnvT e w a Source #

Constructors

EnvT e (w a) 

Instances

Instances details
Comonad w => ComonadEnv e (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Env.Class

Methods

ask :: EnvT e w a -> e Source #

ComonadStore s w => ComonadStore s (EnvT e w) Source # 
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 #

ComonadTraced m w => ComonadTraced m (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Traced.Class

Methods

trace :: m -> EnvT e w a -> a Source #

ComonadHoist (EnvT e) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

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

ComonadTrans (EnvT e) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

lower :: Comonad w => EnvT e w a -> w a Source #

Foldable w => Foldable (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

fold :: Monoid m => EnvT e w m -> m Source #

foldMap :: Monoid m => (a -> m) -> EnvT e w a -> m Source #

foldMap' :: Monoid m => (a -> m) -> EnvT e w a -> m Source #

foldr :: (a -> b -> b) -> b -> EnvT e w a -> b Source #

foldr' :: (a -> b -> b) -> b -> EnvT e w a -> b Source #

foldl :: (b -> a -> b) -> b -> EnvT e w a -> b Source #

foldl' :: (b -> a -> b) -> b -> EnvT e w a -> b Source #

foldr1 :: (a -> a -> a) -> EnvT e w a -> a Source #

foldl1 :: (a -> a -> a) -> EnvT e w a -> a Source #

toList :: EnvT e w a -> [a] Source #

null :: EnvT e w a -> Bool Source #

length :: EnvT e w a -> Int Source #

elem :: Eq a => a -> EnvT e w a -> Bool Source #

maximum :: Ord a => EnvT e w a -> a Source #

minimum :: Ord a => EnvT e w a -> a Source #

sum :: Num a => EnvT e w a -> a Source #

product :: Num a => EnvT e w a -> a Source #

Traversable w => Traversable (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

traverse :: Applicative f => (a -> f b) -> EnvT e w a -> f (EnvT e w b) Source #

sequenceA :: Applicative f => EnvT e w (f a) -> f (EnvT e w a) Source #

mapM :: Monad m => (a -> m b) -> EnvT e w a -> m (EnvT e w b) Source #

sequence :: Monad m => EnvT e w (m a) -> m (EnvT e w a) Source #

(Monoid e, Applicative m) => Applicative (EnvT e m) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

pure :: a -> EnvT e m a Source #

(<*>) :: EnvT e m (a -> b) -> EnvT e m a -> EnvT e m b Source #

liftA2 :: (a -> b -> c) -> EnvT e m a -> EnvT e m b -> EnvT e m c Source #

(*>) :: EnvT e m a -> EnvT e m b -> EnvT e m b Source #

(<*) :: EnvT e m a -> EnvT e m b -> EnvT e m a Source #

Functor w => Functor (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

fmap :: (a -> b) -> EnvT e w a -> EnvT e w b Source #

(<$) :: a -> EnvT e w b -> EnvT e w a Source #

Comonad w => Comonad (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

extract :: EnvT e w a -> a Source #

duplicate :: EnvT e w a -> EnvT e w (EnvT e w a) Source #

extend :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b Source #

(Semigroup e, ComonadApply w) => ComonadApply (EnvT e w) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

(<@>) :: EnvT e w (a -> b) -> EnvT e w a -> EnvT e w b Source #

(@>) :: EnvT e w a -> EnvT e w b -> EnvT e w b Source #

(<@) :: EnvT e w a -> EnvT e w b -> EnvT e w a Source #

(Data e, Typeable w, Data (w a), Data a) => Data (EnvT e w a) Source # 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EnvT e w a -> c (EnvT e w a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (EnvT e w a) Source #

toConstr :: EnvT e w a -> Constr Source #

dataTypeOf :: EnvT e w a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (EnvT e w a)) Source #

dataCast2 :: Typeable t => (forall d e0. (Data d, Data e0) => c (t d e0)) -> Maybe (c (EnvT e w a)) Source #

gmapT :: (forall b. Data b => b -> b) -> EnvT e w a -> EnvT e w a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EnvT e w a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EnvT e w a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> EnvT e w a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> EnvT e w a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EnvT e w a -> m (EnvT e w a) Source #

runEnvT :: EnvT e w a -> (e, w a) Source #

Re-exported modules