Module type PatriciaTree.NodeWithId

include Node

Types

type 'key key

The type of keys.

type ('key, 'map) value

The type of value, which depends on the type of the key and the type of the map.

type 'map t

The type of the map, which is parameterized by a type.

Constructors: build values

val empty : 'map t
val leaf : 'key key -> ('key, 'map) value -> 'map t
val branch : prefix:intkey -> branching_bit:mask -> tree0:'map t -> tree1:'map t -> 'map t

Destructors: access the value

type 'map view = private
  1. | Empty : 'map view
    (*

    Can happen only at the toplevel: there is no empty interior node.

    *)
  2. | Branch : {
    1. prefix : intkey;
    2. branching_bit : mask;
    3. tree0 : 'map t;
    4. tree1 : 'map t;
    } -> 'map view
    (*

    Branching bit contains only one bit set; the corresponding mask is (branching_bit - 1). The prefixes are normalized: the bits below the branching bit are set to zero (i.e. prefix & (branching_bit - 1) = 0).

    *)
  3. | Leaf : {
    1. key : 'key key;
    2. value : ('key, 'map) value;
    } -> 'map view
    (*

    A key -> value mapping.

    *)

This makes the map nodes accessible to the pattern matching algorithm; this corresponds 1:1 to the SimpleNode implementation. This just needs to be copy-and-pasted for every node type.

val is_empty : 'map t -> bool
val view : 'a t -> 'a view

Convert the map to a view

val get_id : 'a t -> int