- | otherwise = partition isNullaryDataCon (tyConDataCons tycon)
-
- cmp_eq
- = mk_FunMonoBind tycon_loc cmp_eq_RDR (map pats_etc nonnullary_cons ++
- if ((length nonnullary_cons + length nullary_cons) == 1)
- then []
- else [([WildPatIn, WildPatIn],
- default_rhs)])
+ | otherwise = partition isNullaryDataCon tycon_data_cons
+
+ cmp_eq =
+ mk_FunMonoBind tycon_loc
+ cmp_eq_RDR
+ (if null nonnullary_cons && (length nullary_cons == 1) then
+ -- catch this specially to avoid warnings
+ -- about overlapping patterns from the desugarer.
+ let
+ data_con = head nullary_cons
+ data_con_RDR = qual_orig_name data_con
+ pat = ConPatIn data_con_RDR []
+ in
+ [([pat,pat], eqTag_Expr)]
+ else
+ map pats_etc nonnullary_cons ++
+ -- leave out wildcards to silence desugarer.
+ (if length tycon_data_cons == 1 then
+ []
+ else
+ [([WildPatIn, WildPatIn], default_rhs)]))