1 import "Prelude" hiding (maximumBy)
3 maximumBy :: Ord b => (a -> b) -> [a] -> a
4 maximumBy f = snd . foldl1 maxF . map (\x -> (f x, x))
6 maxF (a @ (aV,_)) (b @ (bV,_)) = if aV >= bV then a else b
8 main = maximumBy (`mod` 10) [1::Integer, 14, 23, 9, 14, 67]