Bang patterns in do notation and lambdas
Bang patterns in do-notation and lambdas need parentheses around them to parse. This isn't the case for ~ patterns, or bang patterns in let bindings. Seems like a wibble.
{-# OPTIONS -fbang-patterns #-}
-- doesn't work: A.hs:5:8: Empty 'do' construct
main1 = do
!c <- return ()
return ()
-- doesn't work: A.hs:12:24: parse error on input `!'
main2 = return () >>= \ !c -> return ()
-- does
main3 = do
(!c) <- return ()
return ()
-- does
main4 = return () >>= \ (!c) -> return ()
-- does
main5 = let !x = 1 in return ()
-- does
main6 = do
~c <- return ()
return ()
-- does
main7 = return () >>= \ ~c -> return ()
-- dons
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.6 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown |
| Architecture | Unknown |