aboutsummaryrefslogtreecommitdiffstats
path: root/src/Types.hs
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@valuemotive.com>2022-09-24 14:57:00 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-05 14:21:53 +0200
commit23d7d88e21eca2acf8649df9dc7b0a4c3277a8a4 (patch)
treeef6a044b1c5d00934186cf9a6e241204d1433108 /src/Types.hs
parent95fa4b4de7027749a6512def696d07ed64217b50 (diff)
Add support for functions with 0 params
Diffstat (limited to 'src/Types.hs')
-rw-r--r--src/Types.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Types.hs b/src/Types.hs
index 2c29e15..d7fb35c 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -26,6 +26,7 @@ data AST
| ASTFunctionCall [AST]
| ASTHashMap (M.Map AST AST)
| ASTFunction (AST -> LContext AST)
+ | ASTUnit
instance (Show AST) where
show (ASTInteger n) = show n
@@ -39,6 +40,7 @@ instance (Show AST) where
let flattenMap = M.assocs .> L.concatMap (\(k, v) -> [k, v])
in "{" ++ L.intercalate " " (map show $ flattenMap m) ++ "}"
show (ASTFunction _) = "<fn>"
+ show ASTUnit = "<unit>"
instance (Eq AST) where
ASTInteger a == ASTInteger b = a == b
@@ -48,6 +50,7 @@ instance (Eq AST) where
ASTString a == ASTString b = a == b
ASTVector a == ASTVector b = a == b
ASTHashMap a == ASTHashMap b = a == b
+ ASTUnit == ASTUnit = True
_ == _ = False
instance (Ord AST) where