[GHC] #13303: Bad pretty printer for let bindings in a do-notation with braces
GHC
ghc-devs at haskell.org
Sun Feb 19 22:05:20 UTC 2017
#13303: Bad pretty printer for let bindings in a do-notation with braces
-------------------------------------+-------------------------------------
Reporter: rem | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: do-notation, | Operating System: Unknown/Multiple
let, parse |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Let bindings in do-notations with braces like this:
{{{#!hs
module Thing where
thing = do {let {x = 1};
print x}
}}}
get pretty printed with the braces around the bindings stripped, like
this:
{{{#!hs
module Thing where
thing = do {let x = 1;
print x}
}}}
Steps to reproduce: copy the module into Try.hs then call: ghc -ddump-rn
Try.hs
I traced the code to:
https://github.com/ghc/ghc/blob/e28fbbb7c3d5904a88b4743d0d10f212d61d8293/compiler/hsSyn/HsExpr.hs#L1929
which points to the pretty printer for list of declarations:
https://github.com/ghc/ghc/blob/95dc6dc070deac733d4a4a63a93e606a2e772a67/compiler/hsSyn/HsBinds.hs#L492
Indeed there is a comment on the two ways to pretty print binders -
without braces in multiple lines and with braces in one line. However the
comment does not explain the choice, and as discussed in #13302 the former
won't parse in a do-notation.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13303>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list