Function calls now clean up the arguments
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index 68b804d..af49fdf 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -26,7 +26,6 @@ from Text import class Text(concat), instance Text String
 
 import AST
 
-
 :: Scheme = Forall [TVar] Type
 :: Gamma :== 'Map'.Map String Scheme //map from Variables! to types
 :: Typing a :== StateT (Gamma, [TVar]) (Either SemError) a
@@ -173,6 +172,7 @@ generalize :: Type -> Typing Scheme
 generalize t = gamma >>= \g-> pure $ Forall (difference (ftv t) (ftv g)) t
 
 lookup :: String -> Typing Type 
+lookup "isEmpty" = ListType <$> fresh
 lookup k = gamma >>= \g-> case 'Map'.member k g of
     False = liftT (Left $ UndeclaredVariableError zero k)
     True = instantiate $ 'Map'.find k g
@@ -278,7 +278,7 @@ instance infer Stmt where
         changeGamma (extend k (Forall [] given)) >>| //todo: fieldselectors
         pure (s, VoidType)
 
-    FunStmt f es = undef //what is this? 
+    FunStmt f es = pure (zero, VoidType) 
 
     ReturnStmt Nothing = pure (zero, VoidType)
     ReturnStmt (Just e) = infer e