diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-23 08:47:31 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-23 09:22:53 +0100 |
commit | 3e0af469c97d34bea92032d54d155afc65bd4b20 (patch) | |
tree | 63548506546b50bf1af78d82ba92340d77d42510 /compiler/main/InteractiveEval.hs | |
parent | 210a2e122ce3b7c56c780e4541b9f222abe7d2f7 (diff) | |
download | haskell-3e0af469c97d34bea92032d54d155afc65bd4b20.tar.gz |
Give lookupGRE_Name a better API
lookupGRE_Name should return either zero or one GREs, never
several. This is a consequence of INVARIANT 1 on GlobalRdrEnv.
So it's better if it returns a Maybe; the panic on multiple results
is put in one place, instead of being scattered or ignored.
Just refactoring, no change in behaviour
Diffstat (limited to 'compiler/main/InteractiveEval.hs')
-rw-r--r-- | compiler/main/InteractiveEval.hs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs index 5d0d7e75f8..6c95dc3bcc 100644 --- a/compiler/main/InteractiveEval.hs +++ b/compiler/main/InteractiveEval.hs @@ -793,8 +793,7 @@ getInfo allInfo name -- The one we looked for in the first place! | pretendNameIsInScope n = True | isBuiltInSyntax n = True - | isExternalName n = any ((== n) . gre_name) - (lookupGRE_Name rdr_env n) + | isExternalName n = isJust (lookupGRE_Name rdr_env n) | otherwise = True -- | Returns all names in scope in the current interactive context |