[Haskell-cafe] Re: Create a list without duplicates from a list
with duplicates
Stuart Cook
scook0 at gmail.com
Sat Feb 9 09:57:47 EST 2008
On Sun, Feb 10, 2008 at 12:19 AM, ChrisK <haskell at list.mightyreason.com> wrote:
> For Bimap is there anything like Data.Map.insertWithKey ?
No. I wanted to implement the insertWith family, but it wasn't clear
to me what should happen if the value produced by the user's function
already exists, bound to something else.
One possibility might be to do nothing (or error) if that happens,
making it the user's responsibility to not do such things.
Whatever the case may be, it should be possible for client code to
define such an operation, with no more than a constant-factor
overhead. Perhaps I should wait and see if people find themselves
doing this before guessing at an implementation.
(Incidentally, almost everything in Map that's missing from Bimap is
missing either because it doesn't make sense, or because of corner
cases like this one.)
Stuart
More information about the Haskell-Cafe
mailing list