[GHC] #2530: deriving Show adds extra parens for constructor with record syntax
GHC
ghc-devs at haskell.org
Mon Mar 21 18:45:45 UTC 2016
#2530: deriving Show adds extra parens for constructor with record syntax
-------------------------------------+-------------------------------------
Reporter: spl | Owner: bgamari
Type: bug | Status: patch
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 6.8.3
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:D669,
Wiki Page: | Phab:D2027
-------------------------------------+-------------------------------------
Changes (by bgamari):
* status: new => patch
* differential: Phab:D669 => Phab:D669, Phab:D2027
@@ -6,1 +6,1 @@
- {{{
+ {{{#!hs
New description:
Since record construction binds more tightly than function application, no
parentheses are needed when passing a constructor with record syntax to a
function constructor. As a result, we can pass {{{Just A {x = 5}}}} as
shown below.
{{{#!hs
module Main where
data A = A {x :: Int} deriving (Show)
main :: IO ()
main = print $ Just A {x = 5}
}}}
But we get the result in the GHCi session below:
{{{
*Main> main
Just (A {x = 5})
}}}
I tried looking through {{{TcGenDeriv}}}, but didn't figure out quite
where the parenifying was done. {{{nested_compose_Expr}}}?
{{{show_thingies}}}?
I just wanted to make a ticket for general knowledge. Of course, this is
not a real bug. Perhaps you could reclassify it as a feature. Either way,
it would be nice to have.
--
Comment:
Phab:D2027 reverts to the previous behavior including redundant parens as
described in comment:36.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2530#comment:38>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list