On 8/20/07, <b class="gmail_sendername">apfelmus</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Andrew Wagner wrote:<br>> It occurred to me that it would be useful to explicitly<br>> have a Bi-directional Map, which does the maintenance of keeping the<br>> Maps synchronized behind the scenes. Thus, Bimap was born!
<br><br>... most of the map functions (including update above) probably won't<br>work anyway, what should<br><br> left_insertWith (\new old -> new) 'a' 1 (fromList [('a',2),('b',1)])<br>
<br>do? I can't yield<br><br> fromList [('a',1),('b',1)]<br><br>since 1 has two keys now.<br></blockquote></div><br>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.
<br clear="all"><br>-- <br>Rich<br><br>JID: <a href="mailto:email@example.com">firstname.lastname@example.org</a><br>AIM: rnezzy