Representation-polymorphic HasField (fixes #22156)
This generalises the HasField
class to support representation polymorphism,
so that instead of
type HasField :: forall {k} . k -> Type -> Type -> Constraint
we have
type HasField :: forall {k} {r_rep} {a_rep} . k -> TYPE r_rep -> TYPE a_rep -> Constraint
This change was approved by the CLC here: https://github.com/haskell/core-libraries-committee/issues/194#issuecomment-1800412006
The required code changes were surprisingly small. However, a small wrinkle is that this change makes EDIT: this happened anyway with the GHC.Records
no longer inferred as Safe
due to the new import of TYPE
from GHC.Exts
. As far as I know TYPE
is not currently exported from a Trustworthy
module, so I've resorted to marking GHC.Records
as Trustworthy
. I don't know if there is a better solution here.ghc-internal
split, and I don't think it is particularly specific to GHC.Records
anyway.
Merge request reports
Activity
added 2 commits
- 0ad47fd7 - Representation-polymorphic HasField (fixes #22156 (closed))
- 05c2e01b - Mark GHC.Records as Trustworthy
1 1 {-# LANGUAGE AllowAmbiguousTypes #-} 2 {-# LANGUAGE ExplicitForAll #-} 2 3 {-# LANGUAGE FunctionalDependencies #-} 3 4 {-# LANGUAGE PolyKinds #-} 5 {-# LANGUAGE StandaloneKindSignatures #-} 6 {-# LANGUAGE Trustworthy #-} changed this line in version 3 of the diff
added 34 commits
-
c04fcaba...afca46a4 - 32 commits from branch
master
- 0bb36d78 - Representation-polymorphic HasField (fixes #22156 (closed))
- ef383e21 - Mark GHC.Records as Trustworthy
-
c04fcaba...afca46a4 - 32 commits from branch
added 25 commits
-
ef383e21...0d12b987 - 23 commits from branch
master
- 0187ab63 - Representation-polymorphic HasField (fixes #22156 (closed))
- 9ece3194 - Mark GHC.Records as Trustworthy
-
ef383e21...0d12b987 - 23 commits from branch
added 77 commits
-
9ece3194...707a32f5 - 76 commits from branch
master
- 9c4d2575 - Representation-polymorphic HasField (fixes #22156 (closed))
-
9ece3194...707a32f5 - 76 commits from branch
I've rebased this now that !11400 (closed) has landed (which, it turns out, needed to mark
GHC.Records
asTrustworthy
anyway). Hopefully it should now be good to merge?The code looks good to me. I approve with the following asterisks:
-
In
hasfieldrun03.hs
,f1
andf2
,g1
andg2
give identical results. I'd change something so that it's not completely trivial (e.g. makef2
returnf1 + 1
). -
There's a merge conflict and ghc-9.10 already had an rc1 released, so I'm afraid you have to adapt the updates to changelogs to ghc-9.12.
-
added 468 commits
-
9c4d2575...b1e0c313 - 467 commits from branch
master
- c4f4d054 - Representation-polymorphic HasField (fixes #22156 (closed))
-
9c4d2575...b1e0c313 - 467 commits from branch
added 1 commit
- 8554fb65 - Representation-polymorphic HasField (fixes #22156 (closed))
assigned to @marge-bot
I will attempt to batch this MR (!12647 (closed))...
Merged in b84b91f5