I have the following code snippet: import System.IO import Data.String.Utils main = withFile "test.txt" ReadMode $ \handle -> do xs <- getwords handle sequence_ $ map putStrLn (escapeRe xs) getwords :: Handle -> IO [String] getwords h = hGetContents h >>= return . words What I want to to there is to get i.e. "word," or "word!" etc. and arrive at "word". I understand that escapeRe may do this. However, I always get some sort of mismatch errors like this: test.hs:6:38: Couldn't match type `Char' with `[Char]' Expected type: [String] Actual type: String In the return type of a call of `escapeRe' In the second argument of `map', namely `(escapeRe xs)' In the second argument of `($)', namely `map putStrLn (escapeRe xs)' test.hs:6:47: Couldn't match type `[Char]' with `Char' Expected type: String Actual type: [String] In the first argument of `escapeRe', namely `xs' In the second argument of `map', namely `(escapeRe xs)' In the second argument of `($)', namely `map putStrLn (escapeRe xs)' Now I have three questions: 1. Is escapeRe the right function to use here? 2. What do I do wrong? 3. I read in the Real World Haskell book that actually all these file/string operations are very very slow. The recommendation is to work with bytestrings instead. Is there any (fast) way to strip non-alphanumericals from bytestrings? Thanks, --Joerg