Library DocumentationStructuresSignaturesIdentifiersPackagesAbout

Signature EQ_HASH_DYN (pkg github.com/diku-dk/sml-pickle)

Dynamic types with support for equality and hashing.


structure EqHashDyn : EQ_HASH_DYN (pkg github.com/diku-dk/sml-pickle)

signature EQ_HASH_DYN =
  sig
    type dyn
    val new  : ('a -> int -> word) -> ('a * 'a -> bool) -> ('a -> dyn) * (dyn -> 'a)
    val eq   : dyn * dyn -> bool
    val hash : int -> dyn -> word
  end

[type dyn]
Type dynamic.

[new hash eq]
returns a pair of functions (f,g) for embedding (and extracting) an arbitrary value into (and out of) the type dyn. The hash and eq arguments are used for defining the module's hash and eq functions on values of type dyn.

[eq(d1,d2)]
returns the result of applying the underlying equality function provided with new on d1 and d2.

[hash d]
returns the result of applying the underlying hash function provided with new on d.

Discussion
See [1].
 [1] Martin Elsman. Type-Specialized Serialization with Sharing. In
     Sixth Symposium on Trends in Functional Programming (TFP
     ‘05). Tallinn, Estonia. September 2005.


Generated by SigDoc