> module GroupSquash ( groupSquash ) where > import List ( groupBy ) Group-and-squasher utility function: > groupSquash :: (a->a->Bool) -> ([a]->[a]) -> [a] -> [a] > groupSquash eq squasher items = > foldr1 (++) $ map squasher $ groupBy eq items Example usage of this sweet utility function: < let squasher xs = case head xs of < 's' -> "$" < 'p' -> map (const 'q') xs < _ -> xs < in < groupSquash (==) squasher "Mississippi" " ==> Mi$i$iqqi