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