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

GHC cvs-ghc at haskell.org
Fri Jul 13 11:50:35 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):

 Replying to [comment:72 simonmar]:
 > I think it might be better to implement `\case` using a lexer state
 rather than tracking the previous token in the monad as the patch
 currently does.  But it's hard to say for sure without trying it.

 I'm no alex expert, so I don't see how it can be implemented with states.
 The logic here seems to be:
   1. On `\`, return `ITlam` and enter a new state, let's say, AFTER_LAM.
   2. Skip whitespace/comments (works for all states).
   3. If the next token is `case`, then return `ITlcase` and start a new
 layout.
   4. If the next token is not `case`/whitespace/comments, then switch to
 state `0` and return the token.

 How to implement (4)?

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



More information about the Glasgow-haskell-bugs mailing list