diff options
author | Chimrod <> | 2024-03-15 10:20:31 +0100 |
---|---|---|
committer | Chimrod <> | 2024-03-15 10:20:31 +0100 |
commit | 141db078408f94c410508970d07382d4a6087f17 (patch) | |
tree | 10944a42e4b44324aab542d1c2d7c9e1ab2bc9ab /lib/syntax/t.ml | |
parent | 9bb8792a680f19f4a02b402fcf580b5cff245873 (diff) |
Added eq and hash functions in the Ast.Expression
Diffstat (limited to 'lib/syntax/t.ml')
-rw-r--r-- | lib/syntax/t.ml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/syntax/t.ml b/lib/syntax/t.ml index cb9c7ce..882a375 100644 --- a/lib/syntax/t.ml +++ b/lib/syntax/t.ml @@ -7,6 +7,13 @@ type 'a literal = Text of string | Expression of 'a let map_litteral : f:('a -> 'b) -> 'a literal -> 'b literal = fun ~f -> function Text t -> Text t | Expression e -> Expression (f e) +let eq_literal : eq:('a -> 'a -> bool) -> 'a literal -> 'a literal -> bool = + fun ~eq l1 l2 -> + match (l1, l2) with + | Text s1, Text s2 -> String.equal s1 s2 + | Expression e1, Expression e2 -> eq e1 e2 + | _ -> false + type boperator = | Eq | Neq |