\begin{code}
--- XXX - autrijus -
--- Plan: 1. Determine naughtiness by comparing field type vs result type
--- 2. Install naughty ones with selector_ty of type _|_ and fill in mzero for info
--- 3. If it's not naughty, do the normal plan.
+-- Steps for handling "naughty" vs "non-naughty" selectors:
+-- 1. Determine naughtiness by comparing field type vs result type
+-- 2. Install naughty ones with selector_ty of type _|_ and fill in mzero for info
+-- 3. If it's not naughty, do the normal plan.
mkRecordSelId :: TyCon -> FieldLabel -> Id
mkRecordSelId tycon field_label
: d_pat_occ attv_bndrs hs_atys
{ noLoc $ ConDecl (noLoc (mkRdrUnqual $1)) Explicit $2 (noLoc []) (PrefixCon $3) ResTyH98}
| d_pat_occ '::' ty
- -- XXX - autrijus - $3 needs to be split into argument and return types!
+ -- XXX - audreyt - $3 needs to be split into argument and return types!
-- also not sure whether the [] below (quantified vars) appears.
-- also the "PrefixCon []" is wrong.
-- also we want to munge $3 somehow.
get_fields con = dataConFieldLabels con `zip` repeat con
-- dataConFieldLabels may return the empty list, which is fine
- -- XXX - autrijus - Make this far more complex to acommodate
+ -- Note: The complicated checkOne logic below is there to accomodate
-- for different return types. Add res_ty to the mix,
-- comparing them in two steps, all for good error messages.
-- Plan: Use Unify.tcMatchTys to compare the first candidate's