From: quintela Date: Tue, 2 Dec 1997 18:11:33 +0000 (+0000) Subject: [project @ 1997-12-02 18:11:33 by quintela] X-Git-Tag: Approx_2487_patches~1211 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b3912ef355dee6a459d2839e804a71632d52772c;p=ghc-hetmet.git [project @ 1997-12-02 18:11:33 by quintela] data types with one constructor doesn't need WildCadr cases --- diff --git a/ghc/compiler/typecheck/TcGenDeriv.lhs b/ghc/compiler/typecheck/TcGenDeriv.lhs index dde873e..c2e2cf5 100644 --- a/ghc/compiler/typecheck/TcGenDeriv.lhs +++ b/ghc/compiler/typecheck/TcGenDeriv.lhs @@ -286,6 +286,9 @@ cmp_eq _ _ = EQ \end{verbatim} \end{itemize} +If there is only one constructor in the Data Type we don't need the WildCard Patern. +JJQC-30-Nov-1997 + \begin{code} gen_Ord_binds :: TyCon -> RdrNameMonoBinds @@ -320,7 +323,10 @@ gen_Ord_binds tycon cmp_eq = mk_FunMonoBind tycon_loc cmp_eq_RDR (map pats_etc nonnullary_cons ++ - [([WildPatIn, WildPatIn], default_rhs)]) + if ((length nonnullary_cons + length nullary_cons) == 1) + then [] + else [([WildPatIn, WildPatIn], + default_rhs)]) where pats_etc data_con = ([con1_pat, con2_pat],