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 branches found
No related tags found
No related merge requests found
...@@ -286,6 +286,9 @@ cmp_eq _ _ = EQ ...@@ -286,6 +286,9 @@ cmp_eq _ _ = EQ
\end{verbatim} \end{verbatim}
\end{itemize} \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} \begin{code}
gen_Ord_binds :: TyCon -> RdrNameMonoBinds gen_Ord_binds :: TyCon -> RdrNameMonoBinds
...@@ -320,7 +323,10 @@ gen_Ord_binds tycon ...@@ -320,7 +323,10 @@ gen_Ord_binds tycon
cmp_eq cmp_eq
= mk_FunMonoBind tycon_loc cmp_eq_RDR (map pats_etc nonnullary_cons ++ = 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 where
pats_etc data_con pats_etc data_con
= ([con1_pat, con2_pat], = ([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