[GHC] #1041: Bang patterns in do notation and lambdas

GHC trac at galois.com
Thu Dec 7 07:42:49 EST 2006


#1041: Bang patterns in do notation and lambdas
----------------------------------+-----------------------------------------
    Reporter:  dons               |       Owner:               
        Type:  bug                |      Status:  new          
    Priority:  normal             |   Milestone:               
   Component:  Compiler (Parser)  |     Version:  6.6          
    Severity:  normal             |    Keywords:  bang patterns
  Difficulty:  Easy (1 hr)        |    Testcase:               
Architecture:  Unknown            |          Os:  Unknown      
----------------------------------+-----------------------------------------
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

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1041>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list