summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Coercion
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@proton.me>2022-09-18 20:23:23 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-08 12:53:55 -0500
commit68f49874aa217c2222c80c596ef11ffd992b459a (patch)
tree215cafabd967e33b9d1c70182474d3690d1767fa /compiler/GHC/Core/Coercion
parent5fe11fe612e1881bd4d1b9d5950d0d801e08e159 (diff)
downloadhaskell-68f49874aa217c2222c80c596ef11ffd992b459a.tar.gz
Define `Infinite` list and use where appropriate.
Also add perf test for infinite list fusion. In particular, in `GHC.Core`, often we deal with infinite lists of roles. Also in a few locations we deal with infinite lists of names. Thanks to simonpj for helping to write the Note [Fusion for `Infinite` lists].
Diffstat (limited to 'compiler/GHC/Core/Coercion')
-rw-r--r--compiler/GHC/Core/Coercion/Opt.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Coercion/Opt.hs b/compiler/GHC/Core/Coercion/Opt.hs
index 6fa8fc1273..d061d795a7 100644
--- a/compiler/GHC/Core/Coercion/Opt.hs
+++ b/compiler/GHC/Core/Coercion/Opt.hs
@@ -245,7 +245,7 @@ opt_co4 env sym rep r g@(TyConAppCo _r tc cos)
(True, Nominal) ->
mkTyConAppCo Representational tc
(zipWith3 (opt_co3 env sym)
- (map Just (tyConRolesRepresentational tc))
+ (map Just (tyConRoleListRepresentational tc))
(repeat Nominal)
cos)
(False, Nominal) ->
@@ -254,7 +254,7 @@ opt_co4 env sym rep r g@(TyConAppCo _r tc cos)
-- must use opt_co2 here, because some roles may be P
-- See Note [Optimising coercion optimisation]
mkTyConAppCo r tc (zipWith (opt_co2 env sym)
- (tyConRolesRepresentational tc) -- the current roles
+ (tyConRoleListRepresentational tc) -- the current roles
cos)
(_, Phantom) -> pprPanic "opt_co4 sees a phantom!" (ppr g)
@@ -546,7 +546,7 @@ opt_univ env sym prov role oty1 oty2
, equalLength tys1 tys2 -- see Note [Differing kinds]
-- NB: prov must not be the two interesting ones (ProofIrrel & Phantom);
-- Phantom is already taken care of, and ProofIrrel doesn't relate tyconapps
- = let roles = tyConRolesX role tc1
+ = let roles = tyConRoleListX role tc1
arg_cos = zipWith3 (mkUnivCo prov') roles tys1 tys2
arg_cos' = zipWith (opt_co4 env sym False) roles arg_cos
in