diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-11 01:37:40 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-11 12:51:50 +0200 |
| commit | ca75962a335a9954962b0213e060e3895ddc69fb (patch) | |
| tree | 708407988db3bef5c3c0ddff20f106f39c43e496 /src/Builtins.hs | |
| parent | d0614dd946baf05375172d7a50f5eb250b9a7b00 (diff) | |
Fix collection literal evaluation
Diffstat (limited to 'src/Builtins.hs')
| -rw-r--r-- | src/Builtins.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Builtins.hs b/src/Builtins.hs index 511ef08..4ac6598 100644 --- a/src/Builtins.hs +++ b/src/Builtins.hs @@ -27,6 +27,7 @@ builtinEnv = M.fromList $ map (B.second Regular) [ builtinParseInt, builtinParseFloat, builtinStrToVec, + builtinHashMap, -- sequence (vector, string) operations builtinSeqHead, builtinSeqTail, @@ -60,7 +61,8 @@ builtinEnv = M.fromList $ map (B.second Regular) [ reservedKeyword "Debug/env", reservedKeyword "import", reservedKeyword "record", - reservedKeyword "do" + reservedKeyword "do", + reservedKeyword "eval" ] argError1 :: String -> AST -> String @@ -309,6 +311,13 @@ builtinStrToVec = (name, makeNonsenseAST $ ASTFunction Pure fn1) where .> return fn1 ast1 = throwL (astPos ast1, argError1 name ast1) +builtinHashMap :: (String, AST) +builtinHashMap = (name, makeNonsenseAST $ ASTFunction Pure fn1) where + name = "hash-map" + fn1 AST { an = ASTVector vec } = + return $ makeNonsenseAST $ ASTHashMap $ M.fromList $ asPairs vec + fn1 ast1 = throwL (astPos ast1, argError1 name ast1) + builtinPrint :: (String, AST) builtinPrint = (name, makeNonsenseAST $ ASTFunction Impure fn1) where name = "print!" |
