[project @ 2005-04-04 11:55:11 by simonpj]
authorsimonpj <unknown>
Mon, 4 Apr 2005 11:55:17 +0000 (11:55 +0000)
committersimonpj <unknown>
Mon, 4 Apr 2005 11:55:17 +0000 (11:55 +0000)
commitd551dbfef0b710f5ede21ee0c54ee7e80dd53b64
treef49de74d65f1a0351751b7298b518764e1bbe90d
parentcb486104c9225bb44f5ccdd700ff204a37014207
[project @ 2005-04-04 11:55:11 by simonpj]
This commit combines three overlapping things:

1.  Make rebindable syntax work for do-notation. The idea
    here is that, in particular, (>>=) can have a type that
    has class constraints on its argument types, e.g.
       (>>=) :: (Foo m, Baz a) => m a -> (a -> m b) -> m b
    The consequence is that a BindStmt and ExprStmt must have
    individual evidence attached -- previously it was one
    batch of evidence for the entire Do

    Sadly, we can't do this for MDo, because we use bind at
    a polymorphic type (to tie the knot), so we still use one
    blob of evidence (now in the HsStmtContext) for MDo.

    For arrow syntax, the evidence is in the HsCmd.

    For list comprehensions, it's all built-in anyway.

    So the evidence on a BindStmt is only used for ordinary
    do-notation.

2.  Tidy up HsSyn.  In particular:

- Eliminate a few "Out" forms, which we can manage
without (e.g.

- It ought to be the case that the type checker only
decorates the syntax tree, but doesn't change one
construct into another.  That wasn't true for NPat,
LitPat, NPlusKPat, so I've fixed that.

- Eliminate ResultStmts from Stmt.  They always had
to be the last Stmt, which led to awkward pattern
matching in some places; and the benefits didn't seem
to outweigh the costs.  Now each construct that uses
[Stmt] has a result expression too (e.g. GRHS).

3.  Make 'deriving( Ix )' generate a binding for unsafeIndex,
    rather than for index.  This is loads more efficient.

    (This item only affects TcGenDeriv, but some of point (2)
    also affects TcGenDeriv, so it has to be in one commit.)
43 files changed:
ghc/compiler/basicTypes/IdInfo.lhs
ghc/compiler/deSugar/Check.lhs
ghc/compiler/deSugar/DsArrows.lhs
ghc/compiler/deSugar/DsExpr.lhs
ghc/compiler/deSugar/DsGRHSs.lhs
ghc/compiler/deSugar/DsListComp.lhs
ghc/compiler/deSugar/DsMeta.hs
ghc/compiler/deSugar/DsUtils.lhs
ghc/compiler/deSugar/Match.lhs
ghc/compiler/deSugar/MatchCon.lhs
ghc/compiler/deSugar/MatchLit.lhs
ghc/compiler/hsSyn/Convert.lhs
ghc/compiler/hsSyn/HsExpr.hi-boot-6
ghc/compiler/hsSyn/HsExpr.lhs
ghc/compiler/hsSyn/HsExpr.lhs-boot
ghc/compiler/hsSyn/HsLit.lhs
ghc/compiler/hsSyn/HsPat.lhs
ghc/compiler/hsSyn/HsTypes.lhs
ghc/compiler/hsSyn/HsUtils.lhs
ghc/compiler/main/GHC.hs
ghc/compiler/main/HscMain.lhs
ghc/compiler/parser/Parser.y.pp
ghc/compiler/parser/RdrHsSyn.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/rename/RnExpr.lhs
ghc/compiler/rename/RnTypes.lhs
ghc/compiler/typecheck/Inst.lhs
ghc/compiler/typecheck/TcArrows.lhs
ghc/compiler/typecheck/TcExpr.hi-boot-6
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcExpr.lhs-boot
ghc/compiler/typecheck/TcGenDeriv.lhs
ghc/compiler/typecheck/TcHsSyn.lhs
ghc/compiler/typecheck/TcMatches.lhs
ghc/compiler/typecheck/TcPat.lhs
ghc/compiler/typecheck/TcRnDriver.lhs
ghc/compiler/typecheck/TcRnTypes.lhs
ghc/compiler/typecheck/TcTyDecls.lhs
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/typecheck/TcUnify.lhs
ghc/compiler/utils/IOEnv.hs
ghc/compiler/utils/Util.lhs