aboutsummaryrefslogtreecommitdiff
path: root/ast/CC/AST
diff options
context:
space:
mode:
Diffstat (limited to 'ast/CC/AST')
-rw-r--r--ast/CC/AST/Typed.hs9
1 files changed, 9 insertions, 0 deletions
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 $