#4316: Interactive "do" notation in GHCi
---------------------------------+------------------------------------------
    Reporter:  mitar             |        Owner:  vivian      
        Type:  feature request   |       Status:  patch       
    Priority:  normal            |    Milestone:  7.2.1       
   Component:  GHCi              |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by simonmar):

 The basic idea is this: when we get a line of input from the user, we call
 the lexer in "alternative layout rule mode" to read tokens up to the end
 of the line, and then inspect the state of the lexer at that point.  The
 alternative layout rule tracks layout contexts and brackets, so we can
 tell whether the current line is finished or not.  Then we read the next
 line, start lexing it using the state from the previous line, and so on.
 If we get a blank line, finish and parse the input as usual.

 I haven't thought through all the details here, but I think the idea is
 very cool: GHC will be able to tell automatically whether the input is
 complete or not by counting brackets.  One disadvantage is, as you point
 out, a `let` binding would require a double-return to terminate it.  So
 perhaps this automatic multi-line input could be optional, but I imagine
 people would get used to it pretty quickly.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4316#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to