New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amend sized literals to support deriving Show #596
Conversation
Convincing. I just hope that “I don't expect much breakage” is true not only technically but also socially… |
If I'm understanding your PR description correctly, you are proposing two distinct (but related) changes:
This PR amends the sized literals proposal to state change (1) explicitly, but is rather silent about change (2). Can you mention change (2) somewhere as well? Relatedly, |
I've added a mention to this PR.
They already do, as of GHC 9.4 and above. |
Oops, I had incorrectly assumed that they didn't, since |
@nomeata I'm submitting, please review. |
Thanks! I have more questions: |
Also, since this has been around since 8.8, given recent discussions, I wouldn’t feel good about accepting this without checking back with the CLC folks and see if they want to be consulted. |
There is no deriving Looking at the entire
In particular, none of them derive Show. @Bodigrim should CLC be involved? |
I'm surprised you don't get a I'll shepherd this myself. |
@monoidal Our new protocol suggests that we should explicitly invite the CLC to comment. In this case it seems so straightforward that the easiest thing is to open a CLC issue and ask for their approval. Would you like to do that, in parallel with getting GHC SC to agree? |
So you do expect some breakage? What breakage do you expect? After discussing this with @hsyl20 it appears there will be only breakage for golden tests, that relied on the old format? |
@monoidal There still doesn't seem to be anything in the PR content about
@simonpj Is there actually any change to libraries being proposed here? As far as I can see this change impacts |
I tend to agree, but in light of recent discussions let's be polite and ask them if they see it that way too, or if they want to weigh in. |
Huh. I thought it changed the behaviour of a But as Joachim says, it's probably polite to give them a heads-up. Not a CLC proposal then; perhaps just an email to the committee pointing them to this thread? |
I have submitted a CLC issue (link above).
No. My expectation is: definitely no major breakage, likely no breakage at all. Of course I might be wrong - I have started a head.hackage build to get some confirmation.
If someone went through the effort of writing a
It's a bit implicit, but since the edited file is about sized literals of all types, this includes Really, imagine that we already had |
The build passed. |
This has been
Implemented
|
This implements GHC proposal ghc-proposals/ghc-proposals#596 Also add support for Int64# and Word64#; see testcase ShowPrim.
This implements GHC proposal ghc-proposals/ghc-proposals#596 Also add support for Int64# and Word64#; see testcase ShowPrim. (cherry picked from commit 787bae9)
GHC supports deriving
Show
for constructors containing fields of types{Int,Word}{8,16,32}#
.For example, given
we have
x == "MkT (intToInt8# 42#)"
. This has been supported since the introduction ofInt8#
etc. in GHC 8.8.This is rather clumsy. At that time, there was no better way of referring to a number of type
Int8#
. But since #451 we can form literals of those types directly:MkT 42#Int8
.I'm proposing to change deriving
Show
to use that syntax.Show
is supposed to use the normal form (literals and data constructors, no functions).Int64#
. A naive adaptation is wrong on 32-bit: think aboutintToInt64# BIG#
. Using sized literals removes theInt#
indirection and everything just works. Therefore, I'm also proposing to add support forInt64#
andWord64#
, which will work in the same way as{Int,Word}{8,16,32}#
.Deriving Show for other unboxed fields (
Char#
,Int#
etc.) is unaffected.This change is technically changing the behavior of GHC, so I'm submitting it as an amendement to sized literals. It is still minor and I don't expect much breakage:
{Int,Word}{8,16,32}#
are relatively new.I have already implemented this change in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10673/diffs.