With this change, newtype data constructors get a "compulsory" unfolding,
which means that they *must* be inlined, and no top-level definition of
the constructor is provided at all. Since these constructors are no-ops,
I'm not sure why this wasn't the case all along.
NewDC _ -> pprPanic "dataConWorkId" (ppr dc)
dataConWrapId_maybe :: DataCon -> Maybe Id
+-- Returns Nothing if there is no wrapper for an algebraic data con
+-- and also for a newtype (whose constructor is inlined compulsorily)
dataConWrapId_maybe dc = case dcIds dc of
AlgDC mb_wrap _ -> mb_wrap
- NewDC wrap -> Just wrap
+ NewDC wrap -> Nothing
dataConWrapId :: DataCon -> Id
-- Returns an Id which looks like the Haskell-source constructor
isSingleton orig_arg_tys )
-- No existentials on a newtype, but it can have a context
-- e.g. newtype Eq a => T a = MkT (...)
- mkTopUnfolding $ Note InlineMe $
+ mkCompulsoryUnfolding $
mkLams tyvars $ Lam id_arg1 $
mkNewTypeBody tycon result_ty (Var id_arg1)