Proposal #2717: Add nubWith, nubOrd
Mitchell, Neil
neil.mitchell.2 at credit-suisse.com
Tue Oct 21 05:16:57 EDT 2008
Hi,
nubOrd: Seems good. Useful function to have. Shame its not in Data.List,
but I understand the reasons for that, and think this is a perfectly
sensible choice.
nubWith: Seems bad. A not particularly useful function (other than to
write nubOrd), with a fairly confusing name. I have previously used
nubWith to mean nubOn (nubOn f = nubBy ((==) `on` f)) with cacheing of
the function f. As a name, "with" only means "with additional stuff" -
it gives no hint what the additional stuff is. The concept of stop-lists
is a little confusing, and then you tell the user they almost certainly
want to pass [] every single time - in that case why do they get an
option? Also stop-lists have type "b", so
stop-unconstrainted-type-variable seems a more appropriate name :-) The
type signature is fairly complex.
I'm not even convinced that nubWith really is a nub function, and not
just some generalised filter - filterState perhaps. In which case you'd
want to generalise Maybe b to (Bool,b). Can you ever imagine anyone
other than nubOrd using nubWith? Is it a genuine utility function people
have been crying out for? It seems perfectly good to include as a local
function in Data.Set to be used to implement nubOrd, but I don't see its
value as a standalone export from a very commonly used library full of
very useful stuff.
So, in summary I think nubOrd is great, and nubWith isn't nub, and isn't
great.
Thanks
Neil
> -----Original Message-----
> From: libraries-bounces at haskell.org
> [mailto:libraries-bounces at haskell.org] On Behalf Of Bart Massey
> Sent: 21 October 2008 10:04 am
> To: libraries at haskell.org
> Subject: Proposal #2717: Add nubWith, nubOrd
>
> Ok, I've killed the overly ambitious proposal #2629, and
> replaced it with the more modest proposal #2717
> http://hackage.haskell.org/trac/ghc/ticket/2717
> which just adds Data.List.nubWith and Data.Set.nubOrd as
> previously discussed ad nauseam.
>
> I know at least one person thought that adding these was a
> bad idea, but some others thought it was a fine thing to do.
> Hence the discussion on this list.
>
> Bart Massey
> bart at cs.pdx.edu
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
More information about the Libraries
mailing list