-
Notifications
You must be signed in to change notification settings - Fork 140
Closed
Description
It would be nice to have a minimumOn function of the form:
minimumOn :: (Ord b, Generic.Vector v a) => (a -> b) -> v a -> a A possible implementation could just adapt the existing one for minimumBy:
minimumOn :: (Ord b, Vector v a) => (a -> b) -> v a -> a
{-# INLINE minimumOn #-}
minimumOn f = Bundle.foldl1' minBy . stream
where
{-# INLINE minBy #-}
minBy x y = case compare (f x) (f y) of
GT -> y
_ -> xMetadata
Metadata
Assignees
Labels
No labels