Last active
August 29, 2015 14:08
-
-
Save Eckankar/b6e215586b98eca55c0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Text.ParserCombinators.ReadP | |
| import Data.Char | |
| schar :: Char -> ReadP Char | |
| schar c = skipSpaces >> char c | |
| word :: ReadP String | |
| word = skipSpaces >> munch1 isAlphaNum | |
| wordlist :: ReadP [String] | |
| wordlist = sepBy word (schar ',') | |
| input :: ReadP [String] | |
| input = do ls <- wordlist | |
| skipSpaces | |
| eof | |
| return ls | |
| main :: IO () | |
| main = do line <- getLine | |
| print $ show $ readP_to_S input line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment