diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-03-24 10:54:11 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-24 12:14:10 +0100 |
commit | 1448f8ab2379452312f1f74f6d5ba4de8ad3d47e (patch) | |
tree | 9bdbaae957da77bc6af73a6df525213d66ac2f19 /docs/users_guide/bugs.rst | |
parent | ef653f1f819e5213f7a2a7ea1b78e3fa76c66c8e (diff) | |
download | haskell-1448f8ab2379452312f1f74f6d5ba4de8ad3d47e.tar.gz |
Show: Restore redundant parentheses around records
As discussed in #2530 we are going to continue to produce parentheses
here in order to preserve compatibility with previous GHC releases. It
was found that dropped parentheses would break some testsuites which
compared against output from Show. This has been documented in the users
guide.
This reverts commit 5692643c9d17e746327588cd6157a923642b7975.
Test Plan: Validate
Reviewers: hvr, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2027
GHC Trac Issues: #2350
Diffstat (limited to 'docs/users_guide/bugs.rst')
-rw-r--r-- | docs/users_guide/bugs.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index f0c522cf75..ff430098a4 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -223,6 +223,21 @@ Arbitrary-sized tuples splitAt undefined [] = undefined +``Show``\ ing records + The Haskell 2010 definition of ``Show`` stipulates that the rendered + string should only include parentheses which are necessary to unambiguously + parse the result. For historical reasons, ``Show`` instances derived by GHC + include parentheses around records despite the fact that record syntax + binds more tightly than function application; e.g., :: + + data Hello = Hello { aField :: Int } deriving (Show) + + -- GHC produces... + show (Just (Hello {aField=42})) == "Just (Hello {aField=42})" + + -- whereas Haskell 2010 calls for... + show (Just (Hello {aField=42})) == "Just Hello {aField=42}" + ``Read``\ ing integers GHC's implementation of the ``Read`` class for integral types accepts hexadecimal and octal literals (the code in the Haskell 98 |