package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The difference between Hashable and Hashable_t functors is that the former's result type doesn't contain type t and the latter does. Therefore, Hashable can't be used to combine two pairs into 4-tuple. but Hashable_t can. On the other hand result of Hashable_t cannot be combined with Comparable.

example: module Four_ints = Tuple.Hashable_t (Tuple.Hashable_t (Int)(Int)) (Tuple.Hashable_t (Int)(Int))

If instead we used Hashable compiler would complain that the input to outer functor doesn't have type t.

On the other hand: module Foo = struct type t = String.t * Int.t include Tuple.Comparable (String) (Int) include Tuple.Hashable (String) (Int) end

If we used Hashable_t above, the compiler would complain that we have two types t defined.

Unfortunately, it is not possible to define just one functor that could be used in both cases.

Parameters

Signature

include Sexplib0.Sexpable.S with type t := Make(S1)(S2).t
val t_of_sexp : Sexplib0__.Sexp.t -> Make(S1)(S2).t
val sexp_of_t : Make(S1)(S2).t -> Sexplib0__.Sexp.t
include Hashable.S with type t := Make(S1)(S2).t
include Ppx_compare_lib.Comparable.S with type t := Make(S1)(S2).t
val compare : Make(S1)(S2).t Base__Ppx_compare_lib.compare
include Ppx_hash_lib.Hashable.S with type t := Make(S1)(S2).t
val hash_fold_t : Make(S1)(S2).t Base__Ppx_hash_lib.hash_fold
val hash : Make(S1)(S2).t -> Base__Ppx_hash_lib.Std.Hash.hash_value
val hashable : Make(S1)(S2).t Core__.Hashtbl.Hashable.t
module Table : Hashtbl.S with type key = Make(S1)(S2).t
module Hash_set : Hash_set.S with type elt = Make(S1)(S2).t
OCaml

Innovation. Community. Security.