From f7c3b21c0a10b11730bdce64e7e895bd1eb65fd0 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 24 Jul 2020 22:25:50 +0200 Subject: Lift TypeScheme to AST.Typed --- ast/CC/AST/Typed.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ast/CC/AST') diff --git a/ast/CC/AST/Typed.hs b/ast/CC/AST/Typed.hs index f4c4d56..537c7a4 100644 --- a/ast/CC/AST/Typed.hs +++ b/ast/CC/AST/Typed.hs @@ -21,6 +21,9 @@ data TypeT = TFunT TypeT TypeT | TyVar Int deriving (Show, Read) +data TypeSchemeT = TypeSchemeT [Int] TypeT + deriving (Show, Read) + data ExprT = LamT TypeT Occ ExprT | CallT TypeT ExprT ExprT | IntT Int @@ -46,6 +49,12 @@ instance Pretty TypeT where "(" ++ intercalate ", " (map pretty ts) ++ ")" prettyPrec _ (TyVar i) = 't' : show i +instance Pretty TypeSchemeT where + prettyPrec p (TypeSchemeT bnds ty) = + precParens p 2 + ("forall " ++ intercalate " " (map (pretty . TyVar) bnds) ++ ". " ++ + prettyPrec 2 ty) + instance Pretty ExprT where prettyPrec p (LamT ty (Occ n t) e) = precParens p 2 $ -- cgit v1.2.3-70-g09d2