[Git][ghc/ghc][wip/soulomoon/suggest-UnliftedNewtypes-unlifted-data-family-25593] update note
Patrick (@soulomoon)
gitlab at gitlab.haskell.org
Thu Jan 9 07:32:52 UTC 2025
Patrick pushed to branch wip/soulomoon/suggest-UnliftedNewtypes-unlifted-data-family-25593 at Glasgow Haskell Compiler / GHC
Commits:
734c02bb by Patrick at 2025-01-09T15:32:43+08:00
update note
- - - - -
2 changed files:
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
Changes:
=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -2463,7 +2463,7 @@ There are also some changes for dealing with families:
UnliftedNewtypes is on. This allows us to write things like:
data family Foo :: TYPE 'IntRep
-2. In a newtype instance, if the user does
+2. In a newtype instance (with -XUnliftedNewtypes), if the user does
not write a kind signature, we want to allow the possibility that
the kind is not Type, so we use newOpenTypeKind instead of liftedTypeKind.
This is done in tcDataFamInstHeader in GHC.Tc.TyCl.Instance. Example:
@@ -2503,16 +2503,7 @@ If we expect the argument to MkA to have kind Type, then we get a kind-mismatch
error. The problem is that there is no way to connect this mismatch error to
-XUnliftedNewtypes, and suggest enabling the extension. So, instead, we allow
the A to type-check, but then find the problem when doing validity checking (and
-where we get make a suitable error message).
-
-The same handling, is done for newtype data instances, resolving #25593.
-So the following example would be suggested to enable UnliftedNewtypes:
-
- -- no UnliftedNewtypes
- data family D :: UnliftedType
- newtype instance D = MkD Any
-
-One potential worry is
+where we get make a suitable error message). One potential worry is
{-# LANGUAGE PolyKinds #-}
newtype B a = MkB a
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -1028,8 +1028,6 @@ tcDataFamInstHeader mb_clsinfo skol_info fam_tc hs_outer_bndrs fixity
-- Perhaps surprisingly, we don't need the skolemised tvs themselves
; return inner_kind' }
-
-
{- Note [Result kind signature for a data family instance]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The expected type might have a forall at the type. Normally, we
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/734c02bb2a1df715e253212f199713e7c2acaf1c
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/734c02bb2a1df715e253212f199713e7c2acaf1c
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/20250109/0069c354/attachment-0001.html>
More information about the ghc-commits
mailing list