Proposal: add nubOrd somewhere in containers

Joachim Breitner mail at joachim-breitner.de
Fri Oct 20 14:14:38 UTC 2017


Hi,

Am Mittwoch, den 18.10.2017, 13:49 -0400 schrieb David Feuer:
> I am convinced that we should add
> 
> ordNub :: Ord a => [a] -> [a]
> ordNubOn :: Ord b => (a -> b) -> [a] -> [b]
> intNub :: [Int] -> [Int]
> intNubOn :: (a -> Int) -> [a] -> [a]

can we shed the names a bit? I think the operation “nubbing” should be
first, and the details (”…On”, “…By”, “…OrdOn”, “Ord”, “Int”) should be
the second component. This would also have the advantage of listing all
”nub” variants together in an index.

So:

nubOrd   :: Ord a => [a] -> [a]
nubOrdOn :: Ord b => (a -> b) -> [a] -> [b]
nubInt   :: [Int] -> [Int]
nubIntOn :: (a -> Int) -> [a] -> [a]

This is consistent with, say “map” vs. “mapM” and other suffix-based
naming in the libraries.


Greetings,
Joachim
-- 
Joachim Breitner
  mail at joachim-breitner.de
  http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20171020/eb4a1baa/attachment.sig>


More information about the Libraries mailing list