Special-case record fields ending with hash when deriving Read

Authored by RyanGlScott on Mar 14 2018, 9:52 AM.



In commit dbd81f7e86514498218572b9d978373b1699cc5b, a
regression was inadvertently introduced which caused derived Read
instances for record data types with fields ending in a # symbol
(using MagicHash) would no longer parse on valid output. This
is ultimately due to the same reasons as Trac #5041, as we cannot parse
a field name like foo# as a single identifier. We fix this issue
by employing the same workaround as in Trac #5041: first parse the
identifier name foo, then then symbol #.

This is accomplished by the new readFieldHash function in
GHC.Read. This will likely warrant a base- release.

Test Plan

make test TEST=T14918

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Mar 14 2018, 9:52 AM
RyanGlScott added inline comments.Mar 14 2018, 9:59 AM

Do you think the 8.2.1-notes and the 8.4.1-notes should be removed from here, now that 8.4.2 and 8.6.1 are in progress?

  • The Main event
bgamari added inline comments.Mar 19 2018, 12:02 PM

Yes, I suppose we should remove them.

  • Delete 8.2.1- and 8.4.1-notes from users_guide/index.rst
RyanGlScott marked 2 inline comments as done.Mar 19 2018, 12:07 PM
RyanGlScott added inline comments.


bgamari accepted this revision.Mar 23 2018, 10:32 AM

Yes, this looks right to me.

This revision is now accepted and ready to land.Mar 23 2018, 10:32 AM
This revision was automatically updated to reflect the committed changes.
RyanGlScott marked an inline comment as done.