summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Instance
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-07-30 13:50:25 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-04 16:38:40 -0400
commit7a9d8803cfde3c42da4b27a7b89bdcb2ac870e3f (patch)
tree0d2e0dd78e719d93e276fff0a668e8315639ff45 /compiler/GHC/Tc/Instance
parent477bc2dd6d506ece1c5c030f79f3934ff1922a5f (diff)
downloadhaskell-7a9d8803cfde3c42da4b27a7b89bdcb2ac870e3f.tar.gz
Use Reductions to keep track of rewritings
We define Reduction = Reduction Coercion !Type. A reduction of the form 'Reduction co new_ty' witnesses an equality ty ~co~> new_ty. That is, the rewriting happens left-to-right: the right-hand-side type of the coercion is the rewritten type, and the left-hand-side type the original type. Sticking to this convention makes the codebase more consistent, helping to avoid certain applications of SymCo. This replaces the parts of the codebase which represented reductions as pairs, (Coercion,Type) or (Type,Coercion). Reduction being strict in the Type argument improves performance in some programs that rewrite many type families (such as T9872). Fixes #20161 ------------------------- Metric Decrease: T5321Fun T9872a T9872b T9872c T9872d -------------------------
Diffstat (limited to 'compiler/GHC/Tc/Instance')
-rw-r--r--compiler/GHC/Tc/Instance/Family.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Instance/Family.hs b/compiler/GHC/Tc/Instance/Family.hs
index 4818fd9ad9..a7cdb3d507 100644
--- a/compiler/GHC/Tc/Instance/Family.hs
+++ b/compiler/GHC/Tc/Instance/Family.hs
@@ -534,7 +534,7 @@ tcLookupDataFamInst_maybe fam_inst_envs tc tc_args
-- It does not look through type families.
-- It does not normalise arguments to a tycon.
--
--- If the result is Just (rep_ty, (co, gres), rep_ty), then
+-- If the result is Just ((gres, co), rep_ty), then
-- co : ty ~R rep_ty
-- gres are the GREs for the data constructors that
-- had to be in scope