diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-20 16:00:49 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-21 09:18:40 +0100 |
commit | f2d1b7fcbbc55e33375a7321222a9f4ee189aa38 (patch) | |
tree | a5c1553088b608408acebaa2843cc91769aca434 /compiler/stranal/DmdAnal.hs | |
parent | d12c7cb9ee81a68bfcb5f254c016c3c25ed207a4 (diff) | |
download | haskell-f2d1b7fcbbc55e33375a7321222a9f4ee189aa38.tar.gz |
Support unboxing for GADT product types
Beofre this commit we never unboxed GADT, even if they
are perfectly civilised products.
This patch liberalises unboxing slightly.
See Note [Product types] in TyCon.
Still to come
- for strictness, we could maybe deal with existentials too
- todo: unboxing constructor arguments
Diffstat (limited to 'compiler/stranal/DmdAnal.hs')
-rw-r--r-- | compiler/stranal/DmdAnal.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 4117eaec58..21a71de14d 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -211,7 +211,7 @@ dmdAnal' env dmd (Lam var body) dmdAnal' env dmd (Case scrut case_bndr ty [(DataAlt dc, bndrs, rhs)]) -- Only one alternative with a product constructor | let tycon = dataConTyCon dc - , isProductTyCon tycon + , isJust (isDataProductTyCon_maybe tycon) , Just rec_tc' <- checkRecTc (ae_rec_tc env) tycon = let env_w_tc = env { ae_rec_tc = rec_tc' } @@ -257,6 +257,9 @@ dmdAnal' env dmd (Case scrut case_bndr ty alts) (alt_tys, alts') = mapAndUnzip (dmdAnalAlt env dmd case_bndr) alts (scrut_ty, scrut') = dmdAnal env cleanEvalDmd scrut (alt_ty, case_bndr') = annotateBndr env (foldr lubDmdType botDmdType alt_tys) case_bndr + -- NB: Base case is botDmdType, for empty case alternatives + -- This is a unit for lubDmdType, and the right result + -- when there really are no alternatives res_ty = alt_ty `bothDmdType` toBothDmdArg scrut_ty in -- pprTrace "dmdAnal:Case2" (vcat [ text "scrut" <+> ppr scrut |