I wrote the following function that takes a string and returns a new string with each word capitalized: first letter uppercase, following letters lower-cased.
It works, but I would be interested in seeing how a more sophisticated Haskell programmer would do this (if there is already a built-in, great, but still interested in an example implementation).
ghci> let capWord word = [toUpper $ head word] ++ (map toLower $ tail word)
ghci> let capitalize sentence = unwords $ map capWord $ words sentence
ghci> capitalize "the quick brown fox jUMPS OVER thE LaZY DOG"
"The Quick Brown Fox Jumps Over The Lazy Dog"
capitalize
function: stackoverflow.com/questions/15222013/… \$\endgroup\$