[Git][ghc/ghc][wip/soulomoon/suggest-UnliftedNewtypes-unlifted-data-family-25593] add isH98orNewType for clarity
Patrick (@soulomoon)
gitlab at gitlab.haskell.org
Tue Jan 7 06:23:28 UTC 2025
Patrick pushed to branch wip/soulomoon/suggest-UnliftedNewtypes-unlifted-data-family-25593 at Glasgow Haskell Compiler / GHC
Commits:
c7f82a95 by Patrick at 2025-01-07T14:23:01+08:00
add isH98orNewType for clarity
- - - - -
1 changed file:
- compiler/GHC/Tc/TyCl/Instance.hs
Changes:
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -949,10 +949,7 @@ tcDataFamInstHeader mb_clsinfo skol_info fam_tc hs_outer_bndrs fixity
-- Add constraints from the data constructors
-- Fix #25611
-- See Note [Kind inference for data family instances]
- ; case hs_cons of
- (NewTypeCon _) -> kcConDecls new_or_data res_kind hs_cons
- (DataTypeCons _ cons) | isH98 cons -> kcConDecls new_or_data res_kind hs_cons
- _ -> return ()
+ ; when isH98orNewType $ kcConDecls new_or_data res_kind hs_cons
-- Check that the result kind of the TyCon applied to its args
-- is compatible with the explicit signature (or Type, if there
@@ -1009,6 +1006,9 @@ tcDataFamInstHeader mb_clsinfo skol_info fam_tc hs_outer_bndrs fixity
where
fam_name = tyConName fam_tc
data_ctxt = DataKindCtxt fam_name
+ isH98orNewType = case hs_cons of
+ NewTypeCon{} -> True
+ DataTypeCons _ cons -> isH98 cons
isH98 cons = flip any (unLoc <$> cons) $ \case
ConDeclH98{} -> True
_ -> False
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c7f82a95c93813af98ba939f180999bd5e12b6e2
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c7f82a95c93813af98ba939f180999bd5e12b6e2
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250107/f4b7aefc/attachment-0001.html>
More information about the ghc-commits
mailing list