classy-prelude icon indicating copy to clipboard operation
classy-prelude copied to clipboard

Confused about ordNubBy's type

Open kozross opened this issue 8 years ago • 4 comments

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.

kozross avatar Jan 25 '16 01:01 kozross

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.

gregwebs avatar Jan 25 '16 04:01 gregwebs

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?

kozross avatar Jan 25 '16 05:01 kozross

Yes

gregwebs avatar Jan 25 '16 11:01 gregwebs

Alrighty, I'll give it a try.

kozross avatar Jan 25 '16 12:01 kozross