- C.Newtype (make_con_qid (tyConName tcon)) (map make_tbind tyvars) repclause
--- 20060420 GHC handles empty data types just fine. ExtCore should too! jds
--- | null (tyConDataCons tcon) = error "MkExternalCore died: can't handle datatype declarations with no data constructors"
+ C.Newtype (qtc tcon) (map make_tbind tyvars)
+ (case newTyConCo_maybe tcon of
+ Just coercion -> (qtc coercion,
+ make_kind $ (uncurry mkCoKind) $
+ case isCoercionTyCon_maybe coercion of
+ -- See Note [Newtype coercions] in
+ -- types/TyCon
+ Just (arity,coKindFun) -> coKindFun $
+ map mkTyVarTy $ take arity tyvars
+ Nothing -> pprPanic ("MkExternalCore:\
+ coercion tcon should have a kind fun")
+ (ppr tcon))
+ Nothing -> pprPanic ("MkExternalCore: newtype tcon\
+ should have a coercion: ") (ppr tcon))
+ repclause