Sem now prints Gamma
[cc1516.git] / sem.icl
diff --git a/sem.icl b/sem.icl
index 484430d..f9de4fe 100644 (file)
--- a/sem.icl
+++ b/sem.icl
@@ -57,13 +57,13 @@ defaultGamma = extend "print" (Forall ["a"] ((IdType "a") ->> VoidType))
                 $ extend "1printbool" (Forall [] (BoolType ->> VoidType))
                 zero
 
-sem :: AST -> Either [SemError] AST
+sem :: AST -> Either [SemError] (AST, Gamma)
 sem (AST fd) = case foldM (const $ hasNoDups fd) () fd 
                        >>| foldM (const isNiceMain) () fd
                        >>| hasMain fd
-                    >>| evalStateT (type fd) (defaultGamma, variableStream) of
+                    >>| runStateT (type fd) (defaultGamma, variableStream) of
        Left e = Left [e]
-    Right (_,fds) = Right (AST fds)
+    Right ((_,fds),(gam,_)) = Right (AST fds, gam)
 where
                hasNoDups :: [FunDecl] FunDecl -> Either SemError ()
                hasNoDups fds (FunDecl p n _ _ _ _)