Proposal: Add `maxOn` and `minOn` functions to Data.Ord
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Mon May 30 08:29:38 UTC 2016
Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> writes:
> 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)
Yes, sorry. /nearly/ the same type. Still too much risk of confusion.
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Libraries
mailing list