Module Node.Portable

Portable form of a node implementation that can be constructed from a concrete representation and used in computing hashes. Conceptually, a Node.Portable.t is a Node.t in which all internal keys have been replaced with the hashes of the values they point to.

Computations over Portable.t values must commute with those over ts, as in the following diagram:

 ┌────────┐       ┌─────────┐  of_node   ┌────────────────┐
 │  Key   │       │  Node   │ ─────────> │ Node.Portable  │
 └────────┘       └─────────┘            └────────────────┘
   │    │  add/remove  │                         │
to_hash └───────────> (+)     add/remove         │
   │    ┌──────────────┼──────────────────────> (+)
   v    │              v                         v
 ┌────────┐       ┌─────────┐            ┌────────────────┐
 │  Hash  │       │  Node'  │ ─────────> │ Node.Portable' │
 └────────┘       └─────────┘  of_node   └────────────────┘
module Of_node (S : S) : sig ... end

A node implementation with hashes for keys is trivially portable:

module type S = sig ... end