If I understand the documentation of Bimap correctly, there mustn't be a duplicated element in any of the sets (both leftKey and rightKey). That is, if I have a Bimap with a single association (1, 3) and insert an association (either via insertLeft or insertRight): (2, 3), the previous association should be removed. The definition of "bijection" requires it, I think. But it does not:
> m <- newIO :: IO (Bimap Int Int)
> atomically $ insertRight 3 1 m
> atomically $ insertRight 3 2 m
> atomically $ lookupRight 1 m
Just 3
> atomically $ lookupRight 2 m
Just 3
> atomically $ lookupLeft 3 m
Just 2
Is it so "by design" or is it a bug - either in a documentation or in a code?
If I understand the documentation of
Bimap
correctly, there mustn't be a duplicated element in any of the sets (bothleftKey
andrightKey
). That is, if I have aBimap
with a single association(1, 3)
and insert an association (either viainsertLeft
orinsertRight
):(2, 3)
, the previous association should be removed. The definition of "bijection" requires it, I think. But it does not:Is it so "by design" or is it a bug - either in a documentation or in a code?