[commit: ghc] master: Document zonkTyCoVarsAndFV determinism (01bc109)

git at git.haskell.org git at git.haskell.org
Thu May 12 13:42:18 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/01bc10965d993babf6c2c35d340655f683ba0ca2/ghc

>---------------------------------------------------------------

commit 01bc10965d993babf6c2c35d340655f683ba0ca2
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Thu May 12 06:44:52 2016 -0700

    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


>---------------------------------------------------------------

01bc10965d993babf6c2c35d340655f683ba0ca2
 compiler/typecheck/TcMType.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 8ad9aba..94c4947 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.



More information about the ghc-commits mailing list