Proposal for containers: Add 'lookup' function to Data.Set

David Feuer david.feuer at gmail.com
Mon Jul 4 15:53:32 UTC 2016


What we want for Map is definitely not that, but rather

??? :: Ord k => k -> Map k v -> Maybe (k, v)

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.
On Jul 4, 2016 11:48 AM, "Nicolas Godbout" <nicolas.godbout at gmail.com>
wrote:

Correction, there are several errors in the signatures at the end of my
last message.
    > lookup??? :: Eq a => a -> [a] -> Maybe a
    > lookup??? :: Ord a => a -> Set a -> Maybe a
Also, copying the pattern for maps gives a slightly stranger signature
    > lookup??? :: (Ord k, Eq a) => (k,a) -> Map k a -> Maybe (k,a)
which combines a key lookup with an equality test on the value.

Nicolas.

_______________________________________________
Libraries mailing list
Libraries at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160704/1fcaa4b2/attachment.html>


More information about the Libraries mailing list