summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/TyCl/Instance.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/TyCl/Instance.hs')
-rw-r--r--compiler/GHC/Tc/TyCl/Instance.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/GHC/Tc/TyCl/Instance.hs b/compiler/GHC/Tc/TyCl/Instance.hs
index 657e1bffe7..8bfb5370bb 100644
--- a/compiler/GHC/Tc/TyCl/Instance.hs
+++ b/compiler/GHC/Tc/TyCl/Instance.hs
@@ -727,7 +727,7 @@ tcDataFamInstDecl mb_clsinfo tv_skol_env
; traceTc "tcDataFamInstDecl" $
vcat [ text "Fam tycon:" <+> ppr fam_tc
, text "Pats:" <+> ppr pats
- , text "visiblities:" <+> ppr (tcbVisibilities fam_tc pats)
+ , text "visibilities:" <+> ppr (tcbVisibilities fam_tc pats)
, text "all_pats:" <+> ppr all_pats
, text "ty_binders" <+> ppr ty_binders
, text "fam_tc_binders:" <+> ppr (tyConBinders fam_tc)
@@ -940,12 +940,15 @@ tcDataFamInstHeader mb_clsinfo fam_tc outer_bndrs fixity
fam_name = tyConName fam_tc
data_ctxt = DataKindCtxt fam_name
- -- See Note [Implementation of UnliftedNewtypes] in GHC.Tc.TyCl, wrinkle (2).
+ -- See Note [Implementation of UnliftedNewtypes] in GHC.Tc.TyCl, families (2),
+ -- and Note [Implementation of UnliftedDatatypes].
tc_kind_sig Nothing
- = do { unlifted_newtypes <- xoptM LangExt.UnliftedNewtypes
- ; if unlifted_newtypes && new_or_data == NewType
- then newOpenTypeKind
- else pure liftedTypeKind
+ = do { unlifted_newtypes <- xoptM LangExt.UnliftedNewtypes
+ ; unlifted_datatypes <- xoptM LangExt.UnliftedDatatypes
+ ; case new_or_data of
+ NewType | unlifted_newtypes -> newOpenTypeKind
+ DataType | unlifted_datatypes -> newOpenTypeKind
+ _ -> pure liftedTypeKind
}
-- See Note [Result kind signature for a data family instance]