Module CCHash
Hash combinators
Definitions
type 'a t
= 'a -> hash
A hash function for values of type
'a
.
val const0 : _ t
Always 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)
.- since
- 1.5
val int : int t
val bool : bool t
val char : char t
val int32 : int32 t
val int64 : int64 t
val nativeint : nativeint t
val slice : string -> int -> int t
slice s i len state
hashes the slicei, ... i+len-1
ofs
intostate
.
val string : string t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val opt : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t
val if_ : bool -> 'a t -> 'a t -> 'a t
Decide which hash function to use depending on the boolean.
val poly : 'a t
The regular polymorphic hash function.
poly x
isHashtbl.hash x
.
Base hash combinators
Iterators
type 'a sequence
= ('a -> unit) -> unit
type 'a gen
= unit -> 'a option
type 'a klist
= unit -> [ `Nil | `Cons of 'a * 'a klist ]