summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-05-12 06:44:52 -0700
committerBartosz Nitka <niteria@gmail.com>2016-05-12 06:45:13 -0700
commit01bc10965d993babf6c2c35d340655f683ba0ca2 (patch)
tree2b1975779472876822013bbda462e4fb8a996c22
parent697143064c271c57a69e80850a768449f8bcf4ca (diff)
downloadhaskell-01bc10965d993babf6c2c35d340655f683ba0ca2.tar.gz
Document zonkTyCoVarsAndFV determinism
I've changed it to use nonDetEltsUFM and documented why it's OK. Test Plan: it builds Reviewers: bgamari, austin, simonmar, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2204 GHC Trac Issues: #4012
-rw-r--r--compiler/typecheck/TcMType.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 8ad9aba8cd..94c4947be5 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -108,6 +108,7 @@ import FastString
import SrcLoc
import Bag
import Pair
+import UniqFM
import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
@@ -1230,7 +1231,11 @@ zonkTyCoVar tv | isTcTyVar tv = zonkTcTyVar tv
-- painful to make them into TcTyVars there
zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet
-zonkTyCoVarsAndFV tycovars = tyCoVarsOfTypes <$> mapM zonkTyCoVar (varSetElems tycovars)
+zonkTyCoVarsAndFV tycovars =
+ tyCoVarsOfTypes <$> mapM zonkTyCoVar (nonDetEltsUFM tycovars)
+ -- It's OK to use nonDetEltsUFM here because we immediately forget about
+ -- the ordering by turning it into a nondeterministic set and the order
+ -- of zonking doesn't matter for determinism.
-- Takes a list of TyCoVars, zonks them and returns a
-- deterministically ordered list of their free variables.