aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/t.ml
diff options
context:
space:
mode:
authorChimrod <>2024-03-27 15:50:56 +0100
committerChimrod <>2024-03-27 15:50:56 +0100
commit246d3c93e6c628e333c047e225edd284ed156ecb (patch)
treeb0e017132fdf587b83269441d1c54b2446cf0c02 /lib/syntax/t.ml
parent14504f36b603984c14b05995a8928cbd40dfa670 (diff)
parentbaa258ac91df8a80209b322e8d42c5deb2ada536 (diff)
Added the check (I should have had order my commit betters)
Diffstat (limited to 'lib/syntax/t.ml')
-rw-r--r--lib/syntax/t.ml7
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