1
1
mirror of https://github.com/github/semantic.git synced 2024-12-28 09:21:35 +03:00

🔥 withEnv.

This commit is contained in:
Rob Rix 2018-05-30 14:03:19 -04:00
parent c9360b2c61
commit adfa93f6c9

View File

@ -3,7 +3,6 @@ module Control.Abstract.Environment
( Environment
, getEnv
, putEnv
, withEnv
, lookupEnv
, bind
, bindAll
@ -33,15 +32,6 @@ getEnv = send GetEnv
putEnv :: Member (Env address) effects => Environment address -> Evaluator address value effects ()
putEnv = send . PutEnv
-- | Sets the environment for the lifetime of the given action.
withEnv :: Member (Env address) effects => Environment address -> Evaluator address value effects a -> Evaluator address value effects a
withEnv env m = do
oldEnv <- getEnv
putEnv env
result <- m
putEnv oldEnv
pure result
-- | Look a 'Name' up in the current environment, trying the default environment if no value is found.
lookupEnv :: Member (Env address) effects => Name -> Evaluator address value effects (Maybe address)