mkDataTyConRhs cons
= DataTyCon {
data_cons = cons,
- is_enum = -- We define datatypes with no constructors to not be
- -- enumerations; this fixes trac #2578, Otherwise we
- -- end up generating an empty table for
- -- <mod>_<type>_closure_tbl
- -- which is used by tagToEnum# to map Int# to constructors
- -- in an enumeration. The empty table apparently upset
- -- the linker.
- not (null cons) &&
- all isNullarySrcDataCon cons
+ is_enum = not (null cons) && all is_enum_con cons
+ -- See Note [Enumeration types] in TyCon
}
+ where
+ is_enum_con con
+ | (_tvs, theta, arg_tys, _res) <- dataConSig con
+ = null theta && null arg_tys
+
mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs
-- ^ Monadic because it makes a Name for the coercion TyCon