Implement minimumOn, maximumOn to mirror sortOn
By importing Data.List, we currently get:
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
sortOn :: Ord b => (a -> b) -> [a] -> [a]
I believe sortOn to be a very useful 'shortcut'. In that spirit, I propose we add:
maximumOn :: (Foldable t, Ord b) => (a -> b) -> t a -> a
minimumOn :: (Foldable t, Ord b) => (a -> b) -> t a -> a
Trac metadata
Trac field | Value |
---|---|
Version | 8.5 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |