import CostCentre ( mkUserCC )
import FieldLabel ( FieldLabel )
import Id ( Id, idType, recordSelectorFieldLabel )
-import DataCon ( DataCon, dataConId, dataConTyCon, dataConArgTys, dataConFieldLabels )
+import DataCon ( DataCon, dataConWrapId, dataConTyCon, dataConArgTys, dataConFieldLabels )
import PrelInfo ( rEC_CON_ERROR_ID, rEC_UPD_ERROR_ID, iRREFUT_PAT_ERROR_ID, addr2IntegerId )
import TyCon ( isNewTyCon )
import DataCon ( isExistentialDataCon )
let
val_args = zipWithEqual "dsExpr:RecordUpd" mk_val_arg
(dataConFieldLabels con) arg_ids
- rhs = foldl HsApp (DictApp (TyApp (HsVar (dataConId con))
+ rhs = foldl HsApp (DictApp (TyApp (HsVar (dataConWrapId con))
out_inst_tys)
dicts)
val_args
import Type ( mkFunTy, mkAppTy, mkTyVarTy, mkTyVarTys,
ipName_maybe,
splitFunTy_maybe, splitFunTys, isNotUsgTy,
- mkTyConApp,
- splitForAllTys, splitRhoTy,
+ mkTyConApp, splitSigmaTy,
+ splitRhoTy,
isTauTy, tyVarsOfType, tyVarsOfTypes,
isForAllTy, splitAlgTyConApp, splitAlgTyConApp_maybe,
boxedTypeKind, mkArrowKind,
-- Figure out the tycon and data cons from the first field name
let
(Just sel_id : _) = maybe_sel_ids
- (_, tau) = ASSERT( isNotUsgTy (idType sel_id) )
- splitForAllTys (idType sel_id)
+ (_, _, tau) = ASSERT( isNotUsgTy (idType sel_id) )
+ splitSigmaTy (idType sel_id) -- Selectors can be overloaded
+ -- when the data type has a context
Just (data_ty, _) = splitFunTy_maybe tau -- Must succeed since sel_id is a selector
(tycon, _, data_cons) = splitAlgTyConApp data_ty
(con_tyvars, theta, _, _, _, _) = dataConSig (head data_cons)