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 t
s, 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 └────────────────┘