Related to this code golf challenge, I tried to find acronyms with Haskell without using regular expressions.The idea is to split the input string at every space or dash before finally gluing the heads of these parts together, if they are uppercase.This is my code:import System.Environmentimport Data.Charmain :: IO ()main = do    [inp] <- getArgs -- get input from the command line    putStrLn $ getAcronym inpgetAcronym :: String -> StringgetAcronym [] = []getAcronym s  = foldr step [] parts    where parts = split isWordSep s -- split into words          step x acc = if isUpper . head $ x                       then head x : acc else acc -- glue uppercase heads togethersplit :: (a -> Bool) -> [a] -> [[a]]split p []       = []split p s@(x:xs)  | p x       = split p xs -- discard trailing white spaces  | otherwise = w : split p r -- continue with the rest      where (w, r) = break p s -- seperate prefixisWordSep :: Char -> BoolisWordSep x = x == ' ' || x == '-'As this really seems like a very simple problem, my code looks like way too much complexity.Do you have any helpful improvements to slim down my code?
Find acronyms in Haskell
beginner;strings;haskell
With the help of Gurkenglas, I have found a good solution for this problem:First, the getAcronym function can be dramatically reduced by using higher order functions and function composition:getAcronym :: String -> StringgetAcronym = filter isUpper . map head . split isWordSepSecond, the split function can be replaced with Data.List.Split's wordsBy function, reducing the whole code to the following:import System.Environmentimport Data.Charimport Data.List.Split (wordsBy)main :: IO ()main = do    [inp] <- getArgs -- get input from the command line    putStrLn $ getAcronym inpgetAcronym :: String -> StringgetAcronym = filter isUpper . map head . wordsBy isWordSepisWordSep :: Char -> BoolisWordSep x = x == ' ' || x == '-'