[project @ 2002-04-30 14:40:56 by simonmar]
[ghc-hetmet.git] / ghc / compiler / deSugar / DsGRHSs.lhs
index 918ec65..5f101fc 100644 (file)
@@ -12,7 +12,7 @@ import {-# SOURCE #-} DsExpr  ( dsExpr, dsLet )
 import {-# SOURCE #-} Match   ( matchSinglePat )
 
 import HsSyn           ( Stmt(..), HsExpr(..), GRHSs(..), GRHS(..), HsMatchContext(..) )
-import TcHsSyn         ( TypecheckedGRHSs, TypecheckedPat, TypecheckedStmt )
+import TcHsSyn         ( TypecheckedGRHSs, TypecheckedPat, TypecheckedStmt, TypecheckedMatchContext )
 import CoreSyn         ( CoreExpr )
 import Type            ( Type )
 
@@ -45,11 +45,11 @@ dsGuarded grhss
 In contrast, @dsGRHSs@ produces a @MatchResult@.
 
 \begin{code}
-dsGRHSs :: HsMatchContext -> [TypecheckedPat]  -- These are to build a MatchContext from
-       -> TypecheckedGRHSs                     -- Guarded RHSs
+dsGRHSs :: TypecheckedMatchContext -> [TypecheckedPat] -- These are to build a MatchContext from
+       -> TypecheckedGRHSs                             -- Guarded RHSs
        -> DsM (Type, MatchResult)
 
-dsGRHSs kind pats (GRHSs grhss binds (Just ty))
+dsGRHSs kind pats (GRHSs grhss binds ty)
   = mapDs (dsGRHS kind pats) grhss             `thenDs` \ match_results ->
     let 
        match_result1 = foldr1 combineMatchResults match_results
@@ -74,21 +74,21 @@ matchGuard :: [TypecheckedStmt]     -- Guard
            -> DsMatchContext            -- Context
           -> DsM MatchResult
 
--- See comments with HsExpr.HsStmt re what an ExprStmt means
+-- See comments with HsExpr.Stmt re what an ExprStmt means
 -- Here we must be in a guard context (not do-expression, nor list-comp)       
 
-matchGuard [ExprStmt expr locn] ctx 
+matchGuard [ResultStmt expr locn] ctx 
   = putSrcLocDs locn (dsExpr expr)     `thenDs` \ core_expr ->
     returnDs (cantFailMatchResult core_expr)
 
-       -- Other ExprStmts must be guards
+       -- ExprStmts must be guards
        -- Turn an "otherwise" guard is a no-op
-matchGuard (ExprStmt (HsVar v) _ : stmts) ctx
+matchGuard (ExprStmt (HsVar v) _ _ : stmts) ctx
   |  v `hasKey` otherwiseIdKey
   || v `hasKey` trueDataConKey
   = matchGuard stmts ctx
 
-matchGuard (ExprStmt expr locn : stmts) ctx
+matchGuard (ExprStmt expr _ locn : stmts) ctx
   = matchGuard stmts ctx               `thenDs` \ match_result ->
     putSrcLocDs locn (dsExpr expr)     `thenDs` \ pred_expr ->
     returnDs (mkGuardedMatchResult pred_expr match_result)