Skip to content

Commit

Permalink
Hashtbl.to_dyn: sort hashtable keys
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed Jul 29, 2019
1 parent 39e3de1 commit 0cfad4e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/stdune/hashtbl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module Make(H : sig
Dyn.Map (
foldi t ~init:[] ~f:(fun key data acc ->
(H.to_dyn key, f data) :: acc)
|> List.sort ~compare:(fun (k, _) (k', _) -> Dyn.compare k k')
)

let iter t ~f = iter t ~f:(fun ~key:_ ~data -> f data)
Expand Down

0 comments on commit 0cfad4e

Please sign in to comment.