% (c) The University of Glasgow 2001-2006
%
\begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
module MkExternalCore (
emitExternalCore
where
tdef | isNewTyCon tcon =
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"
| otherwise =
C.Data (make_con_qid (tyConName tcon)) (map make_tbind tyvars) (map make_cdef (tyConDataCons tcon))
where repclause | isRecursiveTyCon tcon || isOpenTyCon tcon= Nothing
- | otherwise = Just (make_ty rep)
- where (_, rep) = newTyConRep tcon
+ | otherwise = Just (make_ty (repType rhs))
+ where (_, rhs) = newTyConRhs tcon
tyvars = tyConTyVars tcon
collect_tdefs _ tdefs = tdefs