Proposal: Add `maxOn` and `minOn` functions to Data.Ord

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Mon May 30 08:16:33 UTC 2016


On 30 May 2016 at 18:11, Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> wrote:
> Daniel Díaz Casanueva <dhelta.diaz at gmail.com> writes:
>> minOn :: Ord b => (a -> b) -> a -> a -> a
>> minOn f x y =
>>   case comparing f x y of
>>     LT -> x
>>     _ -> y
>
> Bad name; it’s too close to on min, which has the same type.

Not quite:

> :t on min
on min :: Ord c => (a -> c) -> a -> a -> c

(note the return type is different)

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com


More information about the Libraries mailing list