[project @ 2000-07-11 16:12:11 by simonmar]
[ghc-hetmet.git] / ghc / compiler / deSugar / DsGRHSs.lhs
index e5b823b..9c2557f 100644 (file)
@@ -19,8 +19,7 @@ import Type           ( Type )
 import DsMonad
 import DsUtils
 import PrelInfo                ( nON_EXHAUSTIVE_GUARDS_ERROR_ID )
-import Unique          ( otherwiseIdKey, trueDataConKey, Uniquable(..) )
-import Outputable
+import Unique          ( otherwiseIdKey, trueDataConKey, hasKey, Uniquable(..) )
 \end{code}
 
 @dsGuarded@ is used for both @case@ expressions and pattern bindings.
@@ -81,11 +80,9 @@ matchGuard (ExprStmt expr locn : should_be_null) ctx
 
        -- Turn an "otherwise" guard is a no-op
 matchGuard (GuardStmt (HsVar v) _ : stmts) ctx
-  |  uniq == otherwiseIdKey
-  || uniq == trueDataConKey
+  |  v `hasKey` otherwiseIdKey
+  || v `hasKey` trueDataConKey
   = matchGuard stmts ctx
-  where
-    uniq = getUnique v
 
 matchGuard (GuardStmt expr locn : stmts) ctx
   = matchGuard stmts ctx               `thenDs` \ match_result ->
@@ -107,4 +104,4 @@ Should {\em fail} if @e@ returns @D@
 \begin{verbatim}
 f x | p <- e', let C y# = e, f y# = r1
     | otherwise         = r2 
-\end{verbatim}
\ No newline at end of file
+\end{verbatim}