groupWith +base

groupWith :: Ord b => (a -> b) -> [a] -> [[a]]
base GHC.Exts
The groupWith function uses the user supplied function which projects an element out of every list element in order to to first sort the input list and then to form groups by equality on these projected elements