[GHC] #4359: Implement lambda-case/lambda-if

GHC cvs-ghc at haskell.org
Fri Jul 13 16:48:12 CEST 2012


#4359: Implement lambda-case/lambda-if
-------------------------------+--------------------------------------------
  Reporter:  batterseapower    |          Owner:                  
      Type:  feature request   |         Status:  new             
  Priority:  normal            |      Milestone:  7.6.1           
 Component:  Compiler          |        Version:  7.1             
Resolution:                    |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by mikhail.vorozhtsov):

 I almost got lexer state working, but then I found that it gets in the way
 of layout handling. Assuming we have
 {{{
 <after_lambda> {
   @varid    / { isCaseKeyword } { lambda_case }
   ()        { pop }
 }
 }}}
 the following code will not be parsed correctly
 {{{
 f3 = \ -- comment
        case "1" -> 1
             "2" -> 2
 }}}
 because there is a newline between `\` and `case`. And newline handling
 depends on the previous lexer state in the stack. I probably could write a
 lexer action that checks it (whether we are in do-expression/etc) and does
 the right thing (check offsets, insert `;`, ...), but IMO it would be much
 uglier and error-prone than keeping track of the last non-comment token.
 Any thoughts?

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



More information about the Glasgow-haskell-bugs mailing list