diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-14 08:02:47 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-14 08:02:47 +0100 |
commit | 646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7 (patch) | |
tree | e93985f5775630a6e986e12793650e1a18c378be | |
parent | 64880a4e1fc756ad2e2bb818356b9b3e9ba3c402 (diff) | |
download | micro-lang-hs-646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7.tar.gz micro-lang-hs-646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7.zip |
Return the type of the function
This makes lambda calls work.
-rw-r--r-- | src/Compiler.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Compiler.hs b/src/Compiler.hs index e69ab77..c8889b6 100644 --- a/src/Compiler.hs +++ b/src/Compiler.hs @@ -38,7 +38,7 @@ compile x = do (ev, errs) <- get -- updated with the function (ev, errs) <- - return $ case addSymUniq ev (ident, A.toFuncType params ret, pos) of + return $ case addSymUniq ev (ident, ftype, pos) of Left err -> (ev, err : errs) Right ev -> (ev, errs) -- with parameters @@ -48,7 +48,9 @@ compile x = do (_, errs) <- get -- store updated errors and the env with the function put (ev, errs) - return $ r + return $ Right $ Just ftype + where + ftype = A.toFuncType params ret (A.Call ident args pos) -> do r <- compile ident case r of |