X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FMkExternalCore.lhs;h=e5f81d0a54a65e0f9b00d5226bf91b92e88175d2;hb=bc845b714132a897032502536fea8cd018ce325b;hp=150ae16b1864b3971851f71f2aad20f92f76af72;hpb=e513c1cc1de895fed5796d16cb67525f4b581b2a;p=ghc-hetmet.git diff --git a/compiler/coreSyn/MkExternalCore.lhs b/compiler/coreSyn/MkExternalCore.lhs index 150ae16..e5f81d0 100644 --- a/compiler/coreSyn/MkExternalCore.lhs +++ b/compiler/coreSyn/MkExternalCore.lhs @@ -2,6 +2,12 @@ % (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 @@ -10,16 +16,15 @@ module MkExternalCore ( #include "HsVersions.h" import qualified ExternalCore as C -import Char import Module import CoreSyn import HscTypes import TyCon import TypeRep import Type -import PprExternalCore -- Instances +import PprExternalCore () -- Instances import DataCon -import CoreSyn +import Coercion import Var import IdInfo import Literal @@ -64,13 +69,11 @@ collect_tdefs tcon tdefs 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 @@ -179,7 +182,8 @@ make_ty (NoteTy _ t) = make_ty t make_kind :: Kind -> C.Kind -make_kind (PredTy p) | isEqPred p = panic "coercion kinds in external core not implemented!" +make_kind (PredTy p) | isEqPred p = C.Keq (make_ty t1) (make_ty t2) + where (t1, t2) = getEqPredTys p make_kind (FunTy k1 k2) = C.Karrow (make_kind k1) (make_kind k2) make_kind k | isLiftedTypeKind k = C.Klifted