import Type
import CoreSyn
import Literal
-import CoreUnfold ( mkUnfolding )
+import CoreUnfold ( mkUnfolding, PragmaInfo(..) )
import TysWiredIn ( tupleCon )
import Id ( GenId, mkTemplateLocals, idType,
dataConStrictMarks, dataConFieldLabels, dataConArgTys,
StrictnessMark(..),
isDataCon, isMethodSelId_maybe, isSuperDictSelId_maybe,
isRecordSelector, isPrimitiveId_maybe,
- addIdUnfolding, addIdArity
+ addIdUnfolding, addIdArity,
+ SYN_IE(Id)
)
import IdInfo ( ArityInfo, exactArity )
import Class ( GenClass, GenClassOp, classSig, classOpLocalType )
import Util ( assertPanic, pprTrace,
assoc
)
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable
+#endif
\end{code}
= con_id `addIdUnfolding` unfolding
`addIdArity` exactArity (length locals)
where
- unfolding = mkUnfolding True {- Always inline constructors -} con_rhs
+ unfolding = mkUnfolding IWantToBeINLINEd {- Always inline constructors -} con_rhs
- (tyvars,theta,arg_tys,tycon) = dataConSig con_id
- dict_tys = [mkDictTy clas ty | (clas,ty) <- theta]
- n_dicts = length dict_tys
- result_ty = applyTyCon tycon (mkTyVarTys tyvars)
+ (tyvars, theta, con_tyvars, con_theta, arg_tys, tycon) = dataConSig con_id
- locals = mkTemplateLocals (dict_tys ++ arg_tys)
+ dict_tys = [mkDictTy clas ty | (clas,ty) <- theta]
+ con_dict_tys = [mkDictTy clas ty | (clas,ty) <- con_theta]
+ n_dicts = length dict_tys
+ result_ty = applyTyCon tycon (mkTyVarTys tyvars)
+
+ locals = mkTemplateLocals (dict_tys ++ con_dict_tys ++ arg_tys)
data_args = drop n_dicts locals
(data_arg1:_) = data_args -- Used for newtype only
strict_marks = dataConStrictMarks con_id
`addIdArity` exactArity 1
-- ToDo: consider adding further IdInfo
where
- unfolding = mkUnfolding False {- Don't inline every selector -} sel_rhs
+ unfolding = mkUnfolding NoPragmaInfo {- Don't inline every selector -} sel_rhs
(tyvars, theta, tau) = splitSigmaTy (idType sel_id)
field_lbl = recordSelectorFieldLabel sel_id
maybe_the_arg_id = assocMaybe (field_lbls `zip` arg_ids) field_lbl
error_expr = mkApp (Var pAT_ERROR_ID) [] [rhs_ty] [LitArg msg_lit]
- full_msg = ppShow 80 (ppSep [ppStr "No match in record selector", ppr PprForUser sel_id])
+ full_msg = show (sep [text "No match in record selector", ppr PprForUser sel_id])
msg_lit = NoRepStr (_PK_ full_msg)
\end{code}
maybe_sc_sel_id = isSuperDictSelId_maybe sel_id
Just (cls, the_sc) = maybe_sc_sel_id
- unfolding = mkUnfolding True {- Always inline selectors -} rhs
+ unfolding = mkUnfolding IWantToBeINLINEd {- Always inline selectors -} rhs
rhs = mk_dict_selector [tyvar] dict_id arg_ids the_arg_id
(tyvar, scs, ops) = classSig cls
maybe_meth_sel_id = isMethodSelId_maybe sel_id
Just (cls, the_op) = maybe_meth_sel_id
- unfolding = mkUnfolding True {- Always inline selectors -} rhs
+ unfolding = mkUnfolding IWantToBeINLINEd {- Always inline selectors -} rhs
rhs = mk_dict_selector [tyvar] dict_id arg_ids the_arg_id
(tyvar, scs, ops) = classSig cls
maybe_prim_id = isPrimitiveId_maybe prim_id
Just prim_op = maybe_prim_id
- unfolding = mkUnfolding True {- Always inline PrimOps -} rhs
+ unfolding = mkUnfolding IWantToBeINLINEd {- Always inline PrimOps -} rhs
(tyvars, tau) = splitForAllTy (idType prim_id)
(arg_tys, _) = splitFunTy tau