Data.List.maximumBy uses counter-intuitive ordering
Data.List.maximumBy (Data.Ord.comparing snd) [(0, 1), (3, 2), (2, 2), (1, 1)]
What do you expect the outcome to be?
All Haskell-programmers I know that I asked this question, would answer, based on their intuition,
(3, 2). However, this is not the behaviour that
Data.List.maximumBy currently has: Instead,
(2, 2) (the last occurrence of a 'maximum' element) is kept.
Furthermore, this behaviour is different from the one used by
Data.List.minimumBy. I would therefore like to request:
- If its behaviour is unintentionally different from
minimumBy, alter the implementation to match it.
- If its behaviour is intentionally the opposite, this should be specified in the documentation.