[project @ 2003-10-09 11:58:39 by simonpj]
[ghc-hetmet.git] / ghc / compiler / deSugar / DsGRHSs.lhs
index 5f101fc..75c76d6 100644 (file)
@@ -18,8 +18,10 @@ import Type          ( Type )
 
 import DsMonad
 import DsUtils
+import Unique          ( Uniquable(..) )
 import PrelInfo                ( nON_EXHAUSTIVE_GUARDS_ERROR_ID )
-import PrelNames       ( otherwiseIdKey, trueDataConKey, hasKey )
+import TysWiredIn      ( trueDataConId )
+import PrelNames       ( otherwiseIdKey, hasKey )
 \end{code}
 
 @dsGuarded@ is used for both @case@ expressions and pattern bindings.
@@ -50,7 +52,7 @@ dsGRHSs :: TypecheckedMatchContext -> [TypecheckedPat]        -- These are to build a M
        -> DsM (Type, MatchResult)
 
 dsGRHSs kind pats (GRHSs grhss binds ty)
-  = mapDs (dsGRHS kind pats) grhss             `thenDs` \ match_results ->
+  = mappM (dsGRHS kind pats) grhss             `thenDs` \ match_results ->
     let 
        match_result1 = foldr1 combineMatchResults match_results
        match_result2 = adjustMatchResultDs (dsLet binds) match_result1
@@ -85,7 +87,9 @@ matchGuard [ResultStmt expr locn] ctx
        -- Turn an "otherwise" guard is a no-op
 matchGuard (ExprStmt (HsVar v) _ _ : stmts) ctx
   |  v `hasKey` otherwiseIdKey
-  || v `hasKey` trueDataConKey
+  || v `hasKey` getUnique trueDataConId        
+       -- trueDataConId doesn't have the same 
+       -- unique as trueDataCon
   = matchGuard stmts ctx
 
 matchGuard (ExprStmt expr _ locn : stmts) ctx