From 6e55d34719f89192c9141f50638c6dc5bba71dff Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Tue, 27 Sep 2022 11:11:44 +0300 Subject: Add holes, builtins, improve matching --- src/Utils.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Utils.hs') diff --git a/src/Utils.hs b/src/Utils.hs index 56fd1a2..2b0f271 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -38,6 +38,7 @@ data AST | ASTHashMap (M.Map AST AST) | ASTFunction LFunction | ASTUnit + | ASTHole instance (Show AST) where show (ASTInteger n) = show n @@ -52,6 +53,7 @@ instance (Show AST) where in "{" ++ L.intercalate " " (map show $ flattenMap m) ++ "}" show (ASTFunction _) = "" show ASTUnit = "" + show ASTHole = "" instance (Eq AST) where ASTInteger a == ASTInteger b = a == b @@ -63,6 +65,8 @@ instance (Eq AST) where ASTFunctionCall a == ASTFunctionCall b = a == b ASTHashMap a == ASTHashMap b = a == b ASTUnit == ASTUnit = True + ASTHole == _ = True + _ == ASTHole = True _ == _ = False instance (Ord AST) where @@ -75,6 +79,8 @@ instance (Ord AST) where ASTFunctionCall a <= ASTFunctionCall b = a <= b ASTHashMap a <= ASTHashMap b = a <= b ASTUnit <= ASTUnit = True + ASTHole <= _ = True + _ <= ASTHole = True _ <= _ = False assertIsASTFunction :: AST -> LContext AST -- cgit v1.3