[GHC] #12874: Read/Show Incompatibility in base
GHC
ghc-devs at haskell.org
Tue Aug 22 14:56:18 UTC 2017
#12874: Read/Show Incompatibility in base
-------------------------------------+-------------------------------------
Reporter: andrewthad | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: libraries/base | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3871
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott <ryan.gl.scott@…>):
In [changeset:"8fd959998e900dffdb7f752fcd42df7aaedeae6e/ghc"
8fd95999/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="8fd959998e900dffdb7f752fcd42df7aaedeae6e"
Make the Read instance for Proxy (and friends) ignore precedence
Summary:
The `Read` instance for `Proxy`, as well as a handful of other data
types in `base` which only have a single constructor, are doing something
skeevy: they're requiring that they be surrounded by parentheses if the
parsing
precedence is sufficiently high. This means that `"Thing (Proxy)"` would
parse,
but not `"Thing Proxy"`. But the latter really ought to parse, since
there's no
need to surround a single constructor with parentheses. Indeed, that's the
output of `show (Thing Proxy)`, so the current `Read` instance for `Proxy`
violates `read . show = id`.
The simple solution is to change `readParen (d > 10)` to `readParen False`
in
the `Read` instance for `Proxy`. But given that a derived `Read` instance
would
essentially accomplish the same thing, but with even fewer characters,
I've
opted to just replace the hand-rolled `Read` instance with a derived one.
Test Plan: make test TEST=T12874
Reviewers: ekmett, austin, hvr, goldfire, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #12874
Differential Revision: https://phabricator.haskell.org/D3871
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12874#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list