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 |
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
- class Comonad w => ComonadEnv e w | w -> e where
- ask :: w a -> e
- asks :: ComonadEnv e w => (e -> e') -> w a -> e'
- local :: (e -> e') -> EnvT e w a -> EnvT e' w a
- type Env e = EnvT e Identity
- env :: e -> a -> Env e a
- runEnv :: Env e a -> (e, a)
- data EnvT e w a = EnvT e (w a)
- runEnvT :: EnvT e w a -> (e, w a)
- module Control.Comonad
- module Control.Comonad.Trans.Class
ComonadEnv class
class Comonad w => ComonadEnv e w | w -> e where Source
ComonadEnv e w => ComonadEnv e (IdentityT w) Source | |
ComonadEnv e (Arg e) Source | |
ComonadEnv e ((,) e) Source | |
(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) Source | |
ComonadEnv e w => ComonadEnv e (StoreT t w) Source | |
Comonad w => ComonadEnv e (EnvT e w) 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
The EnvT comonad transformer
EnvT e (w a) |
Comonad w => ComonadEnv e (EnvT e w) Source | |
ComonadStore s w => ComonadStore s (EnvT e w) Source | |
ComonadTraced m w => ComonadTraced m (EnvT e w) Source | |
ComonadTrans (EnvT e) Source | |
ComonadHoist (EnvT e) Source | |
Functor w => Functor (EnvT e w) Source | |
(Monoid e, Applicative m) => Applicative (EnvT e m) Source | |
Foldable w => Foldable (EnvT e w) Source | |
Traversable w => Traversable (EnvT e w) Source | |
(Semigroup e, ComonadApply w) => ComonadApply (EnvT e w) Source | |
Comonad w => Comonad (EnvT e w) Source | |
(Data e, Typeable (* -> *) w, Data (w a), Data a) => Data (EnvT e w a) Source |
Re-exported modules
module Control.Comonad
module Control.Comonad.Trans.Class