summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-03-01 13:47:39 -0500
committerDavid Feuer <David.Feuer@gmail.com>2017-03-01 13:47:41 -0500
commitcbe569a56e2a82bb93a008beb56869d9a6a1d047 (patch)
tree4143ecfabf7b171159c2980e545fe66e0118e1f0 /compiler/rename
parent701256df88c61a2eee4cf00a59e61ef76a57b4b4 (diff)
downloadhaskell-cbe569a56e2a82bb93a008beb56869d9a6a1d047.tar.gz
Upgrade UniqSet to a newtype
The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet` has a key invariant `UniqFM` does not. For example, `fmap` over `UniqSet` will generally produce nonsense. * Upgrade `UniqSet` from a type synonym to a newtype. * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`. * Use cached unique in `tyConsOfType` by replacing `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`. Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3146
Diffstat (limited to 'compiler/rename')
-rw-r--r--compiler/rename/RnBinds.hs6
-rw-r--r--compiler/rename/RnSource.hs6
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rename/RnBinds.hs b/compiler/rename/RnBinds.hs
index f6a22f5df2..f8b3347ca5 100644
--- a/compiler/rename/RnBinds.hs
+++ b/compiler/rename/RnBinds.hs
@@ -48,7 +48,7 @@ import Bag
import Util
import Outputable
import FastString
-import UniqFM
+import UniqSet
import Maybes ( orElse )
import qualified GHC.LanguageExtensions as LangExt
@@ -528,8 +528,8 @@ depAnalBinds binds_w_dus
= (map get_binds sccs, map get_du sccs)
where
sccs = depAnal (\(_, defs, _) -> defs)
- (\(_, _, uses) -> nonDetEltsUFM uses)
- -- It's OK to use nonDetEltsUFM here as explained in
+ (\(_, _, uses) -> nonDetEltsUniqSet uses)
+ -- It's OK to use nonDetEltsUniqSet here as explained in
-- Note [depAnal determinism] in NameEnv.
(bagToList binds_w_dus)
diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs
index 3e462744e1..601d45b90e 100644
--- a/compiler/rename/RnSource.hs
+++ b/compiler/rename/RnSource.hs
@@ -51,7 +51,7 @@ import HscTypes ( HscEnv, hsc_dflags )
import ListSetOps ( findDupsEq, removeDups, equivClasses )
import Digraph ( SCC, flattenSCC, flattenSCCs
, stronglyConnCompFromEdgedVerticesUniq )
-import UniqFM
+import UniqSet
import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
@@ -1348,7 +1348,7 @@ depAnalTyClDecls :: GlobalRdrEnv
depAnalTyClDecls rdr_env ds_w_fvs
= stronglyConnCompFromEdgedVerticesUniq edges
where
- edges = [ (d, tcdName (unLoc d), map (getParent rdr_env) (nonDetEltsUFM fvs))
+ edges = [ (d, tcdName (unLoc d), map (getParent rdr_env) (nonDetEltsUniqSet fvs))
| (d, fvs) <- ds_w_fvs ]
-- It's OK to use nonDetEltsUFM here as
-- stronglyConnCompFromEdgedVertices is still deterministic
@@ -1357,7 +1357,7 @@ depAnalTyClDecls rdr_env ds_w_fvs
toParents :: GlobalRdrEnv -> NameSet -> NameSet
toParents rdr_env ns
- = nonDetFoldUFM add emptyNameSet ns
+ = nonDetFoldUniqSet add emptyNameSet ns
-- It's OK to use nonDetFoldUFM because we immediately forget the
-- ordering by creating a set
where