Tweak order in Map.of_list error (#645)

We should show the key that came earlier in the list first
This commit is contained in:
Rudi Grinberg 2018-03-21 02:08:02 +08:00 committed by Jérémie Dimino
parent d2c85e3329
commit 994fb12651
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ module Make(Key : Comparable.S) : S with type key = Key.t = struct
| [] -> Result.Ok acc
| (k, v) :: l ->
match find acc k with
| None -> loop (add acc k v) l
| Some v' -> Error (k, v, v')
| None -> loop (add acc k v) l
| Some v_old -> Error (k, v_old, v)
in
fun l -> loop empty l