When Data.List.minimumBy comes across list elements that are equal, it chooses the one that came first, but maximumBy chooses the last one:
> import Data.List
> import Data.Ord
> minimumBy (const (const EQ)) "Hello world!"
'H'
> maximumBy (const (const EQ)) "Hello world!"
'!'
Is this by design or by coincidence? Is there a good reasoning behind this behavior?
Note that taking advantage of such an assumption can make code much more succinct - i.e minimumOn length texts instead of using an explicit tie-breaker such as map snd (minimumOn (\(p, t) -> (length t, p)) (zip [0..] texts))