Skip to content

Instantly share code, notes, and snippets.

@spockz
Created March 11, 2012 09:48
Show Gist options
  • Save spockz/2015784 to your computer and use it in GitHub Desktop.
Save spockz/2015784 to your computer and use it in GitHub Desktop.
trimr :: String -> String
trimr = foldr f ""
where
f :: Char -> String -> String
f c [] | c == ' ' = "" -- use Data.Char.isSpace alternatively
| otherwise = [c]
f c xs = c : xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment