fixed read
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index 5ebbc48..f87e5bb 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -52,6 +52,9 @@ defaultGamma :: Gamma //includes all default functions
 defaultGamma = extend "print" (Forall ["a"] ((IdType "a") ->> VoidType))
                 $ extend "isEmpty" (Forall ["a"] ((ListType (IdType "a")) ->> BoolType))
                 $ extend "read" (Forall [] (FuncType CharType))
+                $ extend "1printchar" (Forall [] (CharType ->> VoidType))
+                $ extend "1printint" (Forall [] (IntType ->> VoidType))
+                $ extend "1printbool" (Forall [] (BoolType ->> VoidType))
                 zero
 
 sem :: AST -> Either [SemError] AST
@@ -222,7 +225,7 @@ instance infer Expr where
         infer e2 >>= \(s2, t2, e2_) ->
         pure (compose s2 s1, TupleType (t1,t2), TupleExpr p (e1_,e2_))
 
-    FunExpr p f args fs = //todo: fix print
+    FunExpr p f args fs =
         lookup f >>= \expected ->
         let accST = (\(s,ts,es) e->infer e >>= \(s_,et,e_)-> pure (compose s_ s,ts++[et],es++[e_])) in
         foldM accST (zero,[],[]) args >>= \(s1, argTs, args_)->