Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2002-09-27 08:20:43 by simonpj] · dbc254c3
    Simon Peyton Jones authored
    --------------------------------
            Implement recursive do-notation
    	--------------------------------
    
    This commit adds recursive do-notation, which Hugs has had for some time.
    
    	mdo { x <- foo y ;
    	      y <- baz x ;
    	      return (y,x) }
    
    turns into
    
    	do { (x,y) <- mfix (\~(x,y) -> do { x <- foo y;
    					    y <- baz x }) ;
    	     return (y,x) }
    
    This is all based on work by Levent Erkok and John Lanuchbury.
    
    The really tricky bit is in the renamer (RnExpr.rnMDoStmts) where
    we break things up into minimal segments.  The rest is easy, including
    the type checker.
    
    Levent laid the groundwork, and Simon finished it off. Needless to say,
    I couldn't resist tidying up other stuff, so there's no guaranteed I
    have not broken something.
    dbc254c3