[sledge] Add: Array hash and sexp functions

Summary: For `[@deriving hash, sexp]` convenience.

Reviewed By: jvillard

Differential Revision: D22401037

fbshipit-source-id: f7538ac1f
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 04f7336301
commit d39dd1fee2

@ -82,6 +82,13 @@ module List = List
module Array = struct
include Core.Array
let hash_fold_t hash_fold_elt s a =
Hash.Builtin.hash_fold_array_frozen hash_fold_elt s a
module Import = struct
type 'a array = 'a t [@@deriving compare, equal, hash, sexp]
end
let pp sep pp_elt fs a = List.pp sep pp_elt fs (to_list a)
let fold_map_inplace a ~init ~f =
@ -95,6 +102,7 @@ module Array = struct
!s
end
include Array.Import
module IArray = IArray
include IArray.Import
module Set = Set

@ -79,12 +79,19 @@ module List = List
module Array : sig
include module type of Array
type 'a t = 'a Array.t [@@deriving compare, equal, hash, sexp]
module Import : sig
type 'a array = 'a t [@@deriving compare, equal, hash, sexp]
end
val pp : (unit, unit) fmt -> 'a pp -> 'a array pp
val fold_map_inplace :
'a array -> init:'s -> f:('s -> 'a -> 's * 'a) -> 's
end
include module type of Array.Import
module IArray = IArray
include module type of IArray.Import
module Set = Set

Loading…
Cancel
Save