snoyberg / classy-prelude

A typeclass-based Prelude.
108 stars 15 forks source link

Confused about ordNubBy's type #112

Open kozross opened 8 years ago

kozross commented 8 years ago

According to the Hackage documentation for classy-prelude, ordNubBy has type Ord b => (a -> b) -> (a -> a -> Bool) -> [a] -> [a]. I'm a bit confused as to why it requires two functional arguments. This is especially confusing given other 'by' and 'with' functions only require one additional argument.

Some clarification, both for myself and the documentation, would be appreciated.

gregwebs commented 8 years ago

I think a -> a -> Bool should be replaced with an Eq constraint. Interested in attempting a pull request? The new function would be called ordNubOn.

kozross commented 8 years ago

I'm not entirely sure what you mean, sorry. Do you mean that the second functional argument is meant to be an 'is equal to' function?

gregwebs commented 8 years ago

Yes

kozross commented 8 years ago

Alrighty, I'll give it a try.