Skip to content
Snippets Groups Projects
Commit aeac20ca authored by David Bühler's avatar David Bühler Committed by Andre Maroneze
Browse files

[Eva] Fixes structure for ocaml 4.05.

parent 2df5337b
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,8 @@ module Open ...@@ -139,7 +139,8 @@ module Open
open Shape open Shape
let rec mem : type a. 'v Shape.key -> a structure -> bool = fun key -> function let rec mem : type a. 'v Shape.key -> a structure -> bool = fun key -> function
| Unit | Void -> false | Unit -> false
| Void -> false
| Leaf (k, _) -> Shape.equal key k | Leaf (k, _) -> Shape.equal key k
| Node (left, right) -> mem key left || mem key right | Node (left, right) -> mem key left || mem key right
| Option (s, _) -> mem key s | Option (s, _) -> mem key s
...@@ -154,7 +155,8 @@ module Open ...@@ -154,7 +155,8 @@ module Open
let lift_get f (Get (key, get)) = Get (key, fun t -> get (f t)) let lift_get f (Get (key, get)) = Get (key, fun t -> get (f t))
let rec compute_getters : type a. a structure -> (a getter) KMap.t = function let rec compute_getters : type a. a structure -> (a getter) KMap.t = function
| Unit | Void -> KMap.empty | Unit -> KMap.empty
| Void -> KMap.empty
| Leaf (key, _) -> KMap.singleton key (Get (key, fun (t : a) -> t)) | Leaf (key, _) -> KMap.singleton key (Get (key, fun (t : a) -> t))
| Node (left, right) -> | Node (left, right) ->
let l = compute_getters left and r = compute_getters right in let l = compute_getters left and r = compute_getters right in
...@@ -180,7 +182,8 @@ module Open ...@@ -180,7 +182,8 @@ module Open
let lift_set f (Set (key, set)) = Set (key, fun v b -> f (fun a -> set v a) b) let lift_set f (Set (key, set)) = Set (key, fun v b -> f (fun a -> set v a) b)
let rec compute_setters : type a. a structure -> (a setter) KMap.t = function let rec compute_setters : type a. a structure -> (a setter) KMap.t = function
| Unit | Void -> KMap.empty | Unit -> KMap.empty
| Void -> KMap.empty
| Leaf (key, _) -> KMap.singleton key (Set (key, fun v _t -> v)) | Leaf (key, _) -> KMap.singleton key (Set (key, fun v _t -> v))
| Node (left, right) -> | Node (left, right) ->
let l = compute_setters left and r = compute_setters right in let l = compute_setters left and r = compute_setters right in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment