
#13573: Add Foldable1 to base -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10365, #15566 | Differential Rev(s): Phab:D4812 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * related: #10365 => #10365, #15566 Comment: Also {{{#!hs maximumBy :: Foldable1 f1 => (a -> a -> Ordering) -> (f1 a -> a) maximumBy cmp = foldl1_ max' where max' x y = case cmp x y of GT -> x _ -> y minimumBy :: Foldable1 f1 => (a -> a -> Ordering) -> (f1 a -> a) minimumBy cmp = foldl1_ min' where min' x y = case cmp x y of GT -> y _ -> x }}} and per #15566 {{{#!hs maximumOn, minimumOn :: Foldable1 f1 => Ord cmp => (a -> cmp) -> (f1 a -> a) maximumOn = maximumBy . comparing minimumOn = minimumBy . comparing }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13573#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler