[commit: ghc] master: Kill unnecessary varSetElemsWellScoped in deriveTyData (687c778)
git at git.haskell.org
git at git.haskell.org
Wed Apr 20 15:52:54 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/687c77808b82e8cf8c77fba2c0ed2fe003c907cf/ghc
>---------------------------------------------------------------
commit 687c77808b82e8cf8c77fba2c0ed2fe003c907cf
Author: Bartosz Nitka <niteria at gmail.com>
Date: Wed Apr 20 08:54:10 2016 -0700
Kill unnecessary varSetElemsWellScoped in deriveTyData
varSetElemsWellScoped introduces unnecessary non-determinism and it's possible
to do the same thing deterministically for the same price.
Test Plan: ./validate
Reviewers: austin, simonmar, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2124
GHC Trac Issues: #4012
>---------------------------------------------------------------
687c77808b82e8cf8c77fba2c0ed2fe003c907cf
compiler/typecheck/TcDeriv.hs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index f46fc46..4f45e41 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -63,6 +63,7 @@ import Outputable
import FastString
import Bag
import Pair
+import FV (runFVList, unionFV, someVars)
import qualified GHC.LanguageExtensions as LangExt
import Control.Monad
@@ -644,9 +645,11 @@ deriveTyData tvs tc tc_args deriv_pred
mb_match = tcUnifyTy inst_ty_kind cls_arg_kind
Just kind_subst = mb_match
- all_tkvs = varSetElemsWellScoped $
- mkVarSet deriv_tvs `unionVarSet`
- tyCoVarsOfTypes tc_args_to_keep
+ all_tkvs = toposortTyVars $
+ runFVList $ unionFV
+ (tyCoVarsOfTypesAcc tc_args_to_keep)
+ (someVars deriv_tvs)
+
unmapped_tkvs = filter (`notElemTCvSubst` kind_subst) all_tkvs
(subst, tkvs) = mapAccumL substTyVarBndr
kind_subst unmapped_tkvs
More information about the ghc-commits
mailing list