Skip to content
Snippets Groups Projects
Commit b3912ef3 authored by Juan J. Quintela's avatar Juan J. Quintela
Browse files

[project @ 1997-12-02 18:11:33 by quintela]

data types with one constructor doesn't need WildCadr cases
parent 658b3650
No related merge requests found
......@@ -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],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment