#4148: improve new recursive do syntax
---------------------------------+------------------------------------------
    Reporter:  guest             |        Owner:              
        Type:  feature request   |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  6.12.3      
    Keywords:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Testcase:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by guest):

 I believe both requirements can be satisfied, restating the requirements:

  - simple syntax for mdo with automatic segmentation
  - user control of segmentation

 at first look the two requirements appear to be contradictory, however if
 we observe that there are two syntactically distinguished use cases for
 "rec"
 then perhaps there is room for satisfying both requirements.

 == Proposal ==

 - as per suggestion made here, a translation could be applied,
    when a rec {...} block is the last statement in a do.
    In this case a and only in this case is a dependency analysis
    on the statements done in the mdo to apply mfix to the
    shortest possible subsegments of statements.

 - In the case when the rec appears within the body of a do and
    not in the above final position, follow the original idea of rec
    as stated by Ross.
    the loop/mfix combinators would go wherever the programmer put the rec

 what this achieves is

  - do rec {...} is recognised syntactically, and becomes a drop in
 replacement
    for mdo.
  - when do { ...; rec { ... } ...; } is used it follows the conventions
 stated
    by Ross, thereby providing the programmer with the desired control.

 cons
  - the cons are that some added complexity in tracking the application of
 said translation

 John.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4148#comment:6>
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