Commit 687c7780 authored by niteria's avatar niteria

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
parent cdcf014d
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment