Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Control/Monad/Reader/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ than using the 'Control.Monad.State.State' monad.

module Control.Monad.Reader.Class (
MonadReader(..),
asks,
asks, withEnv
) where

import Control.Monad.Trans.Cont as Cont
Expand Down Expand Up @@ -98,6 +98,10 @@ asks :: MonadReader r m
-> m a
asks = reader

-- | Executes a computation in a predefined environment.
withEnv :: MonadReader r m => r -> m a -> m a
withEnv env = local (const env)

-- ----------------------------------------------------------------------------
-- The partially applied function type is a simple reader monad

Expand Down