[commit: ghc] wip/ghc-8.0-det: Kill unnecessary varSetElemsWellScoped in deriveTyData (1e7f7a8)
git at git.haskell.org
git at git.haskell.org
Thu Jul 14 13:52:53 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc-8.0-det
Link : http://ghc.haskell.org/trac/ghc/changeset/1e7f7a82695449e0f11b0d7142e368ea51eb6e46/ghc
>---------------------------------------------------------------
commit 1e7f7a82695449e0f11b0d7142e368ea51eb6e46
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
>---------------------------------------------------------------
1e7f7a82695449e0f11b0d7142e368ea51eb6e46
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 03f593c..39c9bfc 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
@@ -651,9 +652,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