summaryrefslogtreecommitdiff
path: root/compiler/deSugar/Match.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/deSugar/Match.hs')
-rw-r--r--compiler/deSugar/Match.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs
index ecbed46185..93d43c8d26 100644
--- a/compiler/deSugar/Match.hs
+++ b/compiler/deSugar/Match.hs
@@ -456,6 +456,11 @@ tidy1 _ (TuplePat pats boxity tys)
arity = length pats
tuple_ConPat = mkPrefixConPat (tupleDataCon boxity arity) pats tys
+tidy1 _ (SumPat pat alt arity tys)
+ = return (idDsWrapper, unLoc sum_ConPat)
+ where
+ sum_ConPat = mkPrefixConPat (sumDataCon alt arity) [pat] tys
+
-- LitPats: we *might* be able to replace these w/ a simpler form
tidy1 _ (LitPat lit)
= return (idDsWrapper, tidyLitPat lit)
@@ -485,6 +490,7 @@ tidy_bang_pat v l (CoPat w p t) = tidy1 v (CoPat w (BangPat (L l p)) t)
tidy_bang_pat v _ p@(LitPat {}) = tidy1 v p
tidy_bang_pat v _ p@(ListPat {}) = tidy1 v p
tidy_bang_pat v _ p@(TuplePat {}) = tidy1 v p
+tidy_bang_pat v _ p@(SumPat {}) = tidy1 v p
tidy_bang_pat v _ p@(PArrPat {}) = tidy1 v p
-- Data/newtype constructors
@@ -943,6 +949,7 @@ viewLExprEq (e1,_) (e2,_) = lexp e1 e2
lexp e1 e1' && lexp e2 e2'
exp (ExplicitTuple es1 _) (ExplicitTuple es2 _) =
eq_list tup_arg es1 es2
+ exp (ExplicitSum _ _ e _) (ExplicitSum _ _ e' _) = lexp e e'
exp (HsIf _ e e1 e2) (HsIf _ e' e1' e2') =
lexp e e' && lexp e1 e1' && lexp e2 e2'