[project @ 2002-09-27 08:20:43 by simonpj]
authorsimonpj <unknown>
Fri, 27 Sep 2002 08:20:50 +0000 (08:20 +0000)
committersimonpj <unknown>
Fri, 27 Sep 2002 08:20:50 +0000 (08:20 +0000)
commitdbc254c3dcd64761015a3d1c191ac742caafbf4c
tree76cb6a5a12d47fc79ed13bdc5a8218b7085fe90e
parentb7cc3d012a98cc49abb3441e6637d5148f57f1d1
[project @ 2002-09-27 08:20:43 by simonpj]
--------------------------------
        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.
33 files changed:
ghc/compiler/basicTypes/NameSet.lhs
ghc/compiler/deSugar/DsCCall.lhs
ghc/compiler/deSugar/DsExpr.lhs
ghc/compiler/deSugar/DsListComp.lhs
ghc/compiler/deSugar/DsMeta.hs
ghc/compiler/hsSyn/Convert.lhs
ghc/compiler/hsSyn/HsBinds.lhs
ghc/compiler/hsSyn/HsExpr.lhs
ghc/compiler/hsSyn/HsSyn.lhs
ghc/compiler/main/MkIface.lhs
ghc/compiler/parser/Lex.lhs
ghc/compiler/parser/ParseUtil.lhs
ghc/compiler/parser/Parser.y
ghc/compiler/prelude/PrelInfo.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/rename/RnBinds.lhs
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnNames.lhs
ghc/compiler/rename/RnSource.hi-boot-5
ghc/compiler/rename/RnSource.hi-boot-6
ghc/compiler/rename/RnSource.lhs
ghc/compiler/rename/RnTypes.lhs
ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcGenDeriv.lhs
ghc/compiler/typecheck/TcHsSyn.lhs
ghc/compiler/typecheck/TcMType.lhs
ghc/compiler/typecheck/TcMatches.lhs
ghc/compiler/typecheck/TcRnDriver.lhs
ghc/compiler/typecheck/TcRules.lhs
ghc/compiler/typecheck/TcTyClsDecls.lhs
ghc/compiler/utils/Digraph.lhs
ghc/compiler/utils/Outputable.lhs