mirror of
https://github.com/github/semantic.git
synced 2025-01-02 04:10:29 +03:00
Generalize lookupWith.
This commit is contained in:
parent
a7306d9f73
commit
56c67158cf
@ -162,7 +162,7 @@ lookupEnv :: (Evaluator location term value m, Members '[Reader (Environment loc
|
|||||||
lookupEnv name = (<|>) <$> (Env.lookup name <$> getEnv) <*> (Env.lookup name <$> defaultEnvironment)
|
lookupEnv name = (<|>) <$> (Env.lookup name <$> getEnv) <*> (Env.lookup name <$> defaultEnvironment)
|
||||||
|
|
||||||
-- | Look up a 'Name' in the environment, running an action with the resolved address (if any).
|
-- | Look up a 'Name' in the environment, running an action with the resolved address (if any).
|
||||||
lookupWith :: MonadEvaluator location term value effects m => (Address location value -> m effects a) -> Name -> m effects (Maybe a)
|
lookupWith :: (Evaluator location term value m, Members '[Reader (Environment location value), State (Environment location value)] effects, Monad (m effects)) => (Address location value -> m effects a) -> Name -> m effects (Maybe a)
|
||||||
lookupWith with name = do
|
lookupWith with name = do
|
||||||
addr <- lookupEnv name
|
addr <- lookupEnv name
|
||||||
maybe (pure Nothing) (fmap Just . with) addr
|
maybe (pure Nothing) (fmap Just . with) addr
|
||||||
|
Loading…
Reference in New Issue
Block a user