Std.BiMap.BiMap
1 declaration
type
BiMapThis declaration introduces a public type.
What it does
A map that can be read from either side.
A currency code and its symbol, a user and their session, a variant and its
wire spelling: the pairing is the fact, and which side is the key depends on
which way the program happens to be going. An ordinary Map answers one of
those questions and makes the other a scan of everything it holds.
Keeping a second map by hand answers both, and is two writes that must not
come apart. This does that keeping, so a caller cannot forget half of it.
The part that is not symmetric with Map: a value can collide the way a key
can. Binding a to 1 and then b to 1 cannot leave both, because
looking up 1 would then have two answers and the reverse direction would
no longer be a map at all. The later binding wins and the earlier one is
removed entirely — insert can therefore make the map smaller, which is the
one surprise here and the reason insertChecked exists beside it.
Read the signature
- This declaration has no value signature because it introduces a type or trait.
