CCHashHash combinators
The API of this module is stable as per semantic versioning, like the rest of containers. However the exact implementation of hashing function can change and should not be relied on (i.e. hashing a value always returns the same integer within a run of a program, not across versions of OCaml and Containers).
type 'a t = 'a -> hashA hash function for values of type 'a.
val const0 : _ tAlways return 0. Useful for ignoring elements. Example: Hash.(pair string const0) will map pairs ("a", 1) and ("a", 2) to the same hash, but not the same as ("b", 1).
val int : int tval bool : bool tval char : char tval int32 : int32 tval int64 : int64 tval nativeint : nativeint tval slice : string -> int -> int tslice s i len state hashes the slice i, …, i+len-1 of s into state.
val bytes : bytes tHash a byte array.
val string : string tmap f h is the hasher that takes x, and uses h to hash f x.
For example:
module Str_set = Set.Make(String)
let hash_str_set : Str_set.t CCHash.t = CCHash.(map Str_set.to_seq @@ seq string)val poly : 'a tpoly x is Hashtbl.hash x. The regular polymorphic hash function.
Commutative version of list. Lists that are equal up to permutation will have the same hash.
Commutative version of array. Arrays that are equal up to permutation will have the same hash.
val seq : 'a t -> 'a Stdlib.Seq.t t