case maybeTyConSingleCon tycon of
Just _ -> []
Nothing -> -- if cons don't match, then False
- [([a_Pat, b_Pat], false_Expr)]
+ [([wildPat, wildPat], false_Expr)]
else -- calc. and compare the tags
[([a_Pat, b_Pat],
untag_Expr tycon [(a_RDR,ah_RDR), (b_RDR,bh_RDR)]
enum_index
= mk_easy_FunMonoBind tycon_loc index_RDR
- [AsPatIn c_RDR (TuplePatIn [a_Pat, b_Pat] True{-boxed-}),
+ [AsPatIn c_RDR (TuplePatIn [a_Pat, wildPat] True{-boxed-}),
d_Pat] [] (
HsIf (HsPar (mk_easy_App inRange_RDR [c_RDR, d_RDR])) (
untag_Expr tycon [(a_RDR, ah_RDR)] (
read_con_comprehensions
= map read_con (tyConDataCons tycon)
in
- mk_easy_FunMonoBind tycon_loc readsPrec_RDR [a_Pat, b_Pat] [] (
+ mk_easy_FunMonoBind tycon_loc readsPrec_RDR [_a_Pat, b_Pat] [] (
foldr1 append_Expr read_con_comprehensions
)
where
read_paren_arg -- parens depend on precedence...
| nullary_con = false_Expr -- it's optional.
- | otherwise = HsPar (genOpApp a_Expr gt_RDR (HsLit (HsInt paren_prec_limit)))
-
+ | otherwise = HsPar (genOpApp _a_Expr gt_RDR (HsLit (HsInt paren_prec_limit)))
\end{code}
%************************************************************************
pats_etc data_con
| nullary_con = -- skip the showParen junk...
ASSERT(null bs_needed)
- ([a_Pat, con_pat], show_con)
+ ([wildPat, con_pat], show_con)
| otherwise =
([a_Pat, con_pat],
showParen_Expr (HsPar (genOpApp a_Expr gt_RDR (HsLit (HsInt paren_prec_limit))))
qual_orig_name n = nameRdrName (getName n)
varUnqual n = mkSrcUnqual varName n
+_a_RDR = varUnqual SLIT("_a")
a_RDR = varUnqual SLIT("a")
b_RDR = varUnqual SLIT("b")
c_RDR = varUnqual SLIT("c")
mkHsString s = HsString (_PK_ s)
+_a_Expr = HsVar _a_RDR
a_Expr = HsVar a_RDR
b_Expr = HsVar b_RDR
c_Expr = HsVar c_RDR
tagToEnum_Expr = HsVar tagToEnumH_RDR
con2tag_Expr tycon = HsVar (con2tag_RDR tycon)
+wildPat = WildPatIn
+_a_Pat = VarPatIn _a_RDR
a_Pat = VarPatIn a_RDR
b_Pat = VarPatIn b_RDR
c_Pat = VarPatIn c_RDR