summaryrefslogtreecommitdiff
path: root/compiler/rename/RnNames.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-06-23 08:47:31 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-06-23 09:22:53 +0100
commit3e0af469c97d34bea92032d54d155afc65bd4b20 (patch)
tree63548506546b50bf1af78d82ba92340d77d42510 /compiler/rename/RnNames.hs
parent210a2e122ce3b7c56c780e4541b9f222abe7d2f7 (diff)
downloadhaskell-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/rename/RnNames.hs')
-rw-r--r--compiler/rename/RnNames.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index 2fc62637e8..3803f58da6 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -1973,8 +1973,8 @@ exportClashErr global_env name1 name2 ie1 ie2
-- get_gre finds a GRE for the Name, so that we can show its provenance
get_gre name
= case lookupGRE_Name global_env name of
- (gre:_) -> gre
- [] -> pprPanic "exportClashErr" (ppr name)
+ Just gre -> gre
+ Nothing -> pprPanic "exportClashErr" (ppr name)
get_loc name = greSrcSpan (get_gre name)
(name1', ie1', name2', ie2') = if get_loc name1 < get_loc name2
then (name1, ie1, name2, ie2)