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
Synopsis
- 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 #
Instances
ComonadEnv e (Arg e) Source # | |
Defined in Control.Comonad.Env.Class | |
ComonadEnv e ((,) e) Source # | |
Defined in Control.Comonad.Env.Class | |
Comonad w => ComonadEnv e (EnvT e w) Source # | |
Defined in Control.Comonad.Env.Class | |
ComonadEnv e w => ComonadEnv e (StoreT t w) Source # | |
Defined in Control.Comonad.Env.Class | |
(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) Source # | |
Defined in Control.Comonad.Env.Class | |
ComonadEnv e w => ComonadEnv e (IdentityT w) Source # | |
Defined in Control.Comonad.Env.Class |
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) |
Instances
Comonad w => ComonadEnv e (EnvT e w) Source # | |
Defined in Control.Comonad.Env.Class | |
ComonadStore s w => ComonadStore s (EnvT e w) Source # | |
Defined in Control.Comonad.Store.Class | |
ComonadTraced m w => ComonadTraced m (EnvT e w) Source # | |
Defined in Control.Comonad.Traced.Class | |
ComonadHoist (EnvT e) Source # | |
ComonadTrans (EnvT e) Source # | |
Foldable w => Foldable (EnvT e w) Source # | |
Defined in Control.Comonad.Trans.Env 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 # | |
Traversable w => Traversable (EnvT e w) Source # | |
Defined in Control.Comonad.Trans.Env | |
(Monoid e, Applicative m) => Applicative (EnvT e m) Source # | |
Defined in Control.Comonad.Trans.Env | |
Functor w => Functor (EnvT e w) Source # | |
Comonad w => Comonad (EnvT e w) Source # | |
(Semigroup e, ComonadApply w) => ComonadApply (EnvT e w) Source # | |
(Data e, Typeable w, Data (w a), Data a) => Data (EnvT e w a) Source # | |
Defined in Control.Comonad.Trans.Env 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 # |
Re-exported modules
module Control.Comonad
module Control.Comonad.Trans.Class