[GHC] #14008: NondecreasingIndentation is problematic when the indentation can't be decreased

#14008: NondecreasingIndentation is problematic when the indentation can't be decreased -------------------------------------+------------------------------------- Reporter: allbery_b | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following program, which was deliberately mis-indented (someone playing with an exercise with deliberate errors and being confused by the result): {{{#!hs module Print3Broken where printSecond :: IO () printSecond = do putStrLn greeting -- Yarrrrr out of scope main :: IO () main = do putStrLn greeting printSecond where greeting = "Yarrrrr" }}} With `-XNondecreasingIndentation` on by default, this will parse as long as the definition of `main` (or any other definition) is not present after the `do` block. But there is no legal way to have a definition after the `do` because it is not possible to unindent from column 1 --- and the resulting parse error is a bit confusing and gives no hint that `NondecreasingIndentation` applied to the `do` is the cause. I suspect `NondecreasingIndentation` should not be applied when it is impossible to decrease the indentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14008 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14008: NondecreasingIndentation is problematic when the indentation can't be decreased -------------------------------------+------------------------------------- Reporter: allbery_b | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari):
I suspect `NondecreasingIndentation` should not be applied when it is impossible to decrease the indentation.
This sounds reasonable to me. Would you like to offer a patch? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14008#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14008: NondecreasingIndentation is problematic when the indentation can't be decreased -------------------------------------+------------------------------------- Reporter: allbery_b | Owner: (none) Type: bug | Status: patch Priority: low | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3777 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D3777 Comment: Meh, never mind. Here's a patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14008#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC