[GHC] #13087: AlternativeLayoutRule breaks LambdaCase

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs {-# LANGUAGE AlternativeLayoutRule #-} {-# LANGUAGE LambdaCase #-} isOne :: Int -> Bool isOne = \case 1 -> True _ -> False main = return () }}} {{{ $ ghc test-case [1 of 1] Compiling Main ( test-case.hs, test-case.o ) test-case.hs:5:15: error: parse error on input ‘1’ }}} It compiles fine without the AlternativeLayoutRule extension. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): I'm wondering how you found that flag. I did some digging, it seems like that feature was added with https://github.com/ghc/ghc/commit/16c7844d and later used in https://github.com/ghc/ghc/commit/4edbeb14e to as a part of GHCi's `:m` (which is probably the same thing with `:set +m`). It was never documented, and currently it's not even listed in GHC's man page or user manual. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ohhellojoe): I found the flag via --supported-extensions. I was looking for a layout- related extension that would allow me to forgo indentation of a do block that is the last statement of another do block. It did the trick. Maybe there was a better, more commonly used extension that would have served. {{{#!hs foobar :: IO (Maybe ()) foobar = do putStrLn "doing stuff in IO monad" return $ do Just () -- not indented. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): You're looking for `-XNondecreasingIndentation`: {{{
t13087 cat test.hs {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NondecreasingIndentation #-}
isOne :: Int -> Bool isOne = \case 1 -> True _ -> False foobar :: IO (Maybe ()) foobar = do putStrLn "" return $ do Just () main = return ()
t13087 ghc test.hs [1 of 1] Compiling Main ( test.hs, test.o ) Linking test ... }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | 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:D5236 Wiki Page: | -------------------------------------+------------------------------------- Changes (by harpocrates): * status: new => patch * differential: => Phab:D5236 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase
-------------------------------------+-------------------------------------
Reporter: ohhellojoe | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Parser) |
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:D5236
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | parser/should_compile/T13087 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5236 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => parser/should_compile/T13087 * resolution: => fixed * milestone: => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13087: AlternativeLayoutRule breaks LambdaCase -------------------------------------+------------------------------------- Reporter: ohhellojoe | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | parser/should_compile/T13087 Blocked By: | Blocking: Related Tickets: #10453 | Differential Rev(s): Phab:D5236 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #10453 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13087#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC