<p dir="ltr">I barely care about Data.List association lists. They have no business being in Data.List at all. If compatibility with association lists gets in the way of a good interface, I'll take the good interface anyway.</p>
<div class="gmail_quote">On Jul 4, 2016 12:18 PM, "Nicolas Godbout" <<a href="mailto:nicolas.godbout@gmail.com">nicolas.godbout@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><br></div><div><blockquote type="cite"><div>Le 4 juil. 2016 à 11:53, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> a écrit :</div><br><div><p dir="ltr">What we want for Map is definitely not that, but rather</p><p dir="ltr">??? :: Ord k => k -> Map k v -> Maybe (k, v)</p><p dir="ltr">In each case we look up a key to retrieve an "entry" (whether we want that terminology or not). In the case of a Map, the entry is a key-value pair; in the case of a Set it is merely a key.</p></div></blockquote><div>Agreed.</div><div><br></div><div>However, I am still scratching my head about how the functions we are considering would behave on Lists. The existence of 'Data.List.lookup' also muddles the issues since it works on association lists and not just any list.</div><div><br></div><div>The challenge: find a name '???' such that all three of the following make sense:</div><div><br></div><div>   ??? :: Ord a => a -> Set a -> Maybe a</div><div>   ??? :: Eq a => a -> [a] -> Maybe a</div><div>   ??? :: Ord k => k -> Map k v -> Maybe (k, v)</div><div><br></div><div>A name such a 'lookupKey' looks weird on lists and sets. It is not quite a "containers" problem, but it would be nice to be compatible with "base" names.</div><div><br></div><div>Under this spotlight, what makes sense is 'lookupElem' where elements of lists and sets are obvious, and the elements of a Map are defined as the key-value pairs. Data.Map currently has no function on elements, so this avenue seems open and viable.</div><div><br></div><div><br></div></div></div></blockquote></div>