Fix scoped type variables for expression type signatures
[ghc-hetmet.git] / compiler / coreSyn / MkExternalCore.lhs
index 21b389d..246bfa0 100644 (file)
@@ -69,7 +69,7 @@ collect_tdefs tcon tdefs
 --         | 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 = Nothing
+         where repclause | isRecursiveTyCon tcon || isOpenTyCon tcon= Nothing
                         | otherwise = Just (make_ty rep)
                                            where (_, rep) = newTyConRep tcon
     tyvars = tyConTyVars tcon
@@ -115,7 +115,8 @@ make_exp (App e (Type t)) = C.Appt (make_exp e) (make_ty t)
 make_exp (App e1 e2) = C.App (make_exp e1) (make_exp e2)
 make_exp (Lam v e) | isTyVar v = C.Lam (C.Tb (make_tbind v)) (make_exp e)
 make_exp (Lam v e) | otherwise = C.Lam (C.Vb (make_vbind v)) (make_exp e)
-make_exp (Let b e) = C.Let (make_vdef b) (make_exp e)
+make_exp (Cast e co) = C.Cast (make_exp e) (make_ty co)
+make_exp (Let b e) = C.Let (make_vdef emptyNameSet b) (make_exp e)
 -- gaw 2004
 make_exp (Case e v ty alts) = C.Case (make_exp e) (make_vbind v) (make_ty ty) (map make_alt alts)
 make_exp (Note (SCC cc) e) = C.Note "SCC"  (make_exp e) -- temporary
@@ -174,11 +175,11 @@ 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 (FunTy k1 k2)  = C.Karrow (make_kind k1) (make_kind k2)
 make_kind k
   | isLiftedTypeKind k   = C.Klifted
   | isUnliftedTypeKind k = C.Kunlifted
---   | isUnboxedTypeKind k  = C.Kunboxed       Fix me
   | isOpenTypeKind k     = C.Kopen
 make_kind _ = error "MkExternalCore died: make_kind"