diff options
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 |