Control.Comonad.Trans.Env.Strict

comonad-transformers-2.0.2: Comonad transformers

Portability | portable
Stability | provisional
Maintainer | Edward Kmett <ekmett@gmail.com>

Control.Comonad.Trans.Env.Strict

Contents

- The strict environment comonad
- The strict environment comonad transformer
- Combinators

Description

The environment comonad transformer (aka coreader). This adds an extra value that can be accessed in the environment.

Left adjoint to the reader comonad.

Synopsis

- 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)
- lowerEnvT :: EnvT e w a -> w a
- ask :: EnvT e w a -> e
- asks :: (e -> f) -> EnvT e w a -> f
- local :: (e -> e) -> EnvT e w a -> EnvT e w a

# The strict environment comonad

type Env e = EnvT e Identity

env :: e -> a -> Env e a

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

# The strict environment comonad transformer

data EnvT e w a

Constructors

EnvT e (w a) |

Instances

ComonadTrans (EnvT e) |
ComonadHoist (EnvT e) |
Functor w => Functor (EnvT e w) |
(Typeable s, Typeable1 w) => Typeable1 (EnvT s w) |
Foldable w => Foldable (EnvT e w) |
Traversable w => Traversable (EnvT e w) |
Comonad w => Comonad (EnvT e w) |
Extend w => Extend (EnvT e w) |
(Semigroup e, Apply w) => Apply (EnvT e w) |
(Data e, Typeable1 w, Data (w a), Data a) => Data (EnvT e w a) |
(Typeable s, Typeable1 w, Typeable a) => Typeable (EnvT s w a) |

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

lowerEnvT :: EnvT e w a -> w a

# Combinators

ask :: EnvT e w a -> e

asks :: (e -> f) -> EnvT e w a -> f

local :: (e -> e) -> EnvT e w a -> EnvT e w a