intDataCon_RDR, true_RDR, false_RDR )
import Util ( zipWithEqual, isSingleton,
zipWith3Equal, nOfThem, zipEqual )
-import Char ( isAlpha )
import Constants
import List ( partition, intersperse )
import Outputable
tycon_loc = getSrcSpan tycon
--------------------------------------------------------------------
- compare = L tycon_loc (FunBind (L tycon_loc compare_RDR) False compare_matches placeHolderNames)
- compare_matches = mkMatchGroup [mkMatch [a_Pat, b_Pat] compare_rhs cmp_eq_binds]
+ compare = L tycon_loc (mkFunBind (L tycon_loc compare_RDR) compare_matches)
+ compare_matches = [mkMatch [a_Pat, b_Pat] compare_rhs cmp_eq_binds]
cmp_eq_binds = HsValBinds (ValBindsIn (unitBag cmp_eq) [])
compare_rhs
infix_stmts -- a %% b, or a `T` b
= [read_a1]
- ++ if isSym con_str
- then [bindLex (symbol_pat con_str)]
- else [read_punc "`", bindLex (ident_pat con_str), read_punc "`"]
+ ++ (if isSym con_str
+ then [bindLex (symbol_pat con_str)]
+ else [read_punc "`", bindLex (ident_pat con_str), read_punc "`"])
++ [read_a2]
lbl_stmts -- T { f1 = a, f2 = b }
ident_pat s = nlConPat ident_RDR [nlLitPat (mkHsString s)] -- Ident "foo"
symbol_pat s = nlConPat symbol_RDR [nlLitPat (mkHsString s)] -- Symbol ">>"
- data_con_str con = occNameUserString (getOccName con)
+ data_con_str con = occNameString (getOccName con)
read_punc c = bindLex (punc_pat c)
read_arg a ty
| otherwise
= [bindLex (ident_pat lbl_str)]
where
- lbl_str = occNameUserString (getOccName lbl)
+ lbl_str = occNameString (getOccName lbl)
\end{code}
dc_nm = getName data_con
dc_occ_nm = getOccName data_con
- con_str = occNameUserString dc_occ_nm
+ con_str = occNameString dc_occ_nm
op_con_str = wrapOpParens con_str
backquote_str = wrapOpBackquotes con_str
-- it seems tidier to have them both sides.
where
occ_nm = getOccName l
- nm = wrapOpParens (occNameUserString occ_nm)
+ nm = wrapOpParens (occNameString occ_nm)
show_args = zipWith show_arg bs_needed arg_tys
(show_arg1:show_arg2:_) = show_args
constr_args dc =
[ -- nlHsIntLit (toInteger (dataConTag dc)), -- Tag
nlHsVar data_type_name, -- DataType
- nlHsLit (mkHsString (occNameUserString dc_occ)), -- String name
+ nlHsLit (mkHsString (occNameString dc_occ)), -- String name
nlList labels, -- Field labels
nlHsVar fixity] -- Fixity
where
= mkDerivedRdrName tc_name mk_occ
where
tc_name = tyConName tycon
- mk_occ tc_occ = mkOccFS varName (mkFastString new_str)
+ mk_occ tc_occ = mkVarOccFS (mkFastString new_str)
where
new_str = str ++ occNameString tc_occ ++ "#"
\end{code}