bimap is:module
An implementation of bidirectional maps between values of two key
types. A
Bimap is essentially a bijection between subsets of
its two argument types.
Each element of the left-hand type is associated with an element of
the right-hand type, and vice-versa, such that the two mappings are
inverses. Deleting an element will cause its twin to be deleted, and
inserting a pair of elements will cause any overlapping bindings to be
deleted.
Most functions implicitly consider the left-hand type to be the key,
and the right-hand type to be the value. Functions with an
R
suffix reverse this convention, treating the right-hand type as the
key and the left-hand type as the value.
Partly invertible finite maps.
Time complexities are given under the assumption that all relevant
instance functions, as well as arguments of function type, take
constant time, and "n" is the number of keys involved in the
operation.
Bimap between
Word8 an an arbitrary (ordered) type. Values of
type
Word8Bimap have to be constructed carefully to contain
values for all 256
Word8 values, or the API will not be safe to
use.