import VarSet
import BasicTypes
import Name
-import OccName
import MkId
import Class
import TyCon
import TcRnMonad
import Util ( count )
import Outputable
-
-import Data.List
\end{code}
mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
mkDataTyConRhs cons
- = DataTyCon { data_cons = cons, is_enum = all isNullarySrcDataCon 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
+ }
mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs
-- Monadic because it makes a Name for the coercion TyCon
------------------------------------------------------
buildDataCon :: Name -> Bool
- -> [StrictnessMark]
+ -> [HsBang]
-> [Name] -- Field labels
-> [TyVar] -> [TyVar] -- Univ and ext
-> [(TyVar,Type)] -- Equality spec
; dict_con <- buildDataCon datacon_name
False -- Not declared infix
- (map (const NotMarkedStrict) args)
+ (map (const HsNoBang) args)
[{- No fields -}]
tvs [{- no existentials -}]
[{- No GADT equalities -}] [{- No theta -}]