Safe Haskell | Safe |
---|---|

Language | Haskell98 |

This module provides a generic way to combine multiple `MonadReader`

contexts into a single one.

## Example

{-# LANGUAGE TupleSections #-} f :: (MonadReader r m, Has A r, Has B r) => m () f = do (a :: A) <- ask (b :: B) <- ask doSomething a b main = let a = makeA :: A b = makeB :: B in flip runReaderT (a, ()) . withReaderT (b,) $ f

- class Has a t where
- get :: t -> a

- ask :: (MonadReader r m, Has a r) => m a
- asks :: (MonadReader r m, Has a r) => (a -> b) -> m b

# Documentation

class Has a t where

get :: t -> a

Has' (Embedded a t HFalse) a t => Has a t | This instance means |

ask :: (MonadReader r m, Has a r) => m a

Replacement for `ask`

.

asks :: (MonadReader r m, Has a r) => (a -> b) -> m b

Replacement for `asks`

.