From: pimjager Date: Wed, 13 Apr 2016 17:52:24 +0000 (+0200) Subject: Function parameters X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=7da52fb9413e5caa334f9f3cde809f85a94b5d54;hp=--cc;p=cc1516.git Function parameters --- 7da52fb9413e5caa334f9f3cde809f85a94b5d54 diff --git a/examples/StmtEx.spl b/examples/StmtEx.spl index d52e5b7..ef8cb88 100644 --- a/examples/StmtEx.spl +++ b/examples/StmtEx.spl @@ -16,10 +16,10 @@ facR(n) :: Int -> Int { return 5; } -test(n) :: Int -> Bool { +test(e) :: Int -> Bool { var i = 0; facR(z); - while (n < 3) { + while (e < 3) { return True; } } diff --git a/sem.icl b/sem.icl index addadad..603d53a 100644 --- a/sem.icl +++ b/sem.icl @@ -49,7 +49,7 @@ semFunDecl fd=:(FunDecl p f args mt vds stmts) = (case mt of Nothing = let t = IdType f in putIdent f t >>| pure t Just t = putIdent f t >>| pure t) >>= \ft -> - mapM_ (\a-> putIdent a (IdType <$> freshIdent)) args >>| + mapM_ (\a-> freshIdent >>= \fr-> putIdent a (IdType fr)) args >>| mapM_ semVarDecl vds >>| mapM_ (checkStmt $ resultType ft) stmts >>| restoreGamma gamma >>| pure fd