1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 18:23:44 +03:00
This commit is contained in:
Rick Winfrey 2018-07-06 10:36:34 -07:00
parent 1c8e90a918
commit fbac72665c

View File

@ -123,10 +123,10 @@ instance ( Coercible body (Eff effects)
product <- foldl mergeEnvs lowerBound . catMaybes <$> traverse scopedEnvironment supers
pure $ Class n (mergeEnvs product env)
namespace n env = do
maybeAddr <- lookupEnv n
namespace name env = do
maybeAddr <- lookupEnv name
env' <- maybe (pure lowerBound) (asNamespaceEnv <=< deref) maybeAddr
pure (Namespace n (Env.mergeNewer env' env))
pure (Namespace name (Env.mergeNewer env' env))
where asNamespaceEnv v
| Namespace _ env' <- v = pure env'
| otherwise = throwValueError $ NamespaceError ("expected " <> show v <> " to be a namespace")