On 8/20/07, apfelmus <apfelmus@quantentunnel.de> wrote:
Andrew Wagner wrote:
> It occurred to me that it would be useful to explicitly
> have a Bi-directional Map, which does the maintenance of keeping the
> Maps synchronized behind the scenes. Thus, Bimap was born!

... most of the map functions (including  update  above) probably won't
work anyway, what should

   left_insertWith (\new old -> new) 'a' 1 (fromList [('a',2),('b',1)])

do? I can't yield

   fromList [('a',1),('b',1)]

since 1 has two keys now.

Exactly. For this to work there needs to be the constraint that there's a one-to-one mapping in each direction. The Bimap should have the uniqueness promise that "Set (k, v)" gives. Yet you should be able to search on either tuple value.

--
Rich

JID: rich@neswold.homeunix.net
AIM: rnezzy