diff options
| author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-04-30 12:43:00 +0100 |
|---|---|---|
| committer | Simon Peyton Jones <simonpj@microsoft.com> | 2021-05-04 08:47:22 +0100 |
| commit | c7b8dd7ddba8b9a7f9506d32527237bd40d8ce70 (patch) | |
| tree | 1b8223dc56e4e5e957f7504d9ef05fcb574fc29e /compiler/GHC/Core/Coercion.hs | |
| parent | 24a9b1708cee95670e7ec2a6ceb68e29fc376cf7 (diff) | |
| download | haskell-wip/T19768.tar.gz | |
Persist CorePrepProv into IfaceUnivCoProvwip/T19768
CorePrepProv is only created in CorePrep, so I thought it wouldn't be
needed in IfaceUnivCoProv. But actually IfaceSyn is used during
pretty-printing, and we can certainly pretty-print things after
CorePrep as #19768 showed.
So the simplest thing is to represent CorePrepProv in IfaceSyn.
To improve what Lint can do I also added a boolean to CorePrepProv, to
record whether it is homogeneously kinded or not. It is introduced in
two distinct ways (see Note [Unsafe coercions] in GHC.CoreToStg.Prep),
one of which may be hetero-kinded (e.g. Int ~ Int#) beause it is
casting a divergent expression; but the other is not. The boolean
keeps track.
Diffstat (limited to 'compiler/GHC/Core/Coercion.hs')
| -rw-r--r-- | compiler/GHC/Core/Coercion.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs index 4fcd366dfe..b364091958 100644 --- a/compiler/GHC/Core/Coercion.hs +++ b/compiler/GHC/Core/Coercion.hs @@ -1352,7 +1352,7 @@ setNominalRole_maybe r co | case prov of PhantomProv _ -> False -- should always be phantom ProofIrrelProv _ -> True -- it's always safe PluginProv _ -> False -- who knows? This choice is conservative. - CorePrepProv -> True + CorePrepProv _ -> True = Just $ UnivCo prov Nominal co1 co2 setNominalRole_maybe_helper _ = Nothing @@ -1456,10 +1456,10 @@ promoteCoercion co = case co of AxiomInstCo {} -> mkKindCo co AxiomRuleCo {} -> mkKindCo co - UnivCo (PhantomProv kco) _ _ _ -> kco + UnivCo (PhantomProv kco) _ _ _ -> kco UnivCo (ProofIrrelProv kco) _ _ _ -> kco - UnivCo (PluginProv _) _ _ _ -> mkKindCo co - UnivCo CorePrepProv _ _ _ -> mkKindCo co + UnivCo (PluginProv _) _ _ _ -> mkKindCo co + UnivCo (CorePrepProv _) _ _ _ -> mkKindCo co SymCo g -> mkSymCo (promoteCoercion g) @@ -2283,7 +2283,7 @@ seqProv :: UnivCoProvenance -> () seqProv (PhantomProv co) = seqCo co seqProv (ProofIrrelProv co) = seqCo co seqProv (PluginProv _) = () -seqProv CorePrepProv = () +seqProv (CorePrepProv _) = () seqCos :: [Coercion] -> () seqCos [] = () |
