[GHC] #9042: List indenting in case fails
GHC
ghc-devs at haskell.org
Sun Apr 27 19:30:19 UTC 2014
#9042: List indenting in case fails
-------------------------------------+------------------------------------
Reporter: laar | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: invalid | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Changes (by goldfire):
* status: new => closed
* resolution: => invalid
Comment:
I would say GHC's behavior in this case is correct. According to (my
understanding of) the layout rule, the first character after a layout
herald (the `of`, in your case) sets the new indentation level (provided
it is not too far left!). So, your open-bracket sets the indentation
level. Then, your comma is at the same level of indentation, so GHC
inserts a `;` before the comma, causing the parse error.
So, that syntax ''is'' available in patterns, as witness by the following
(accepted) code:
{{{
t = case Just [1..2] of
Just [ 1
, 2
] -> True
_ -> False
}}}
In this example, the `J` of the `Just` in the pattern sets the indentation
level, so there's no problem laying out the list vertically.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9042#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list