Here's a particularly cheeky way to proceed:
parseCommaSepQuotedWords :: String -> [String]
parseCommaSepQuotedWords s = read ("[" ++ s ++ "]")
This might work but it's very fragile and rather silly. Essentially you are using the fact that the Haskell way of writing lists of strings almost coincides with your way, and hence the built-in Read instance is almost the thing you want. You could use reads for better error-reporting but in reality you probably want to do something else entirely.
In general, parsec is really worth taking a look at - it's a joy to use, and one of the things that originally really got me excited about Haskell. But if you want a homegrown solution, I often write simple things using case statements on the result of span and break. Suppose you are looking for the next semicolon in the input. Then break (== ';') inp will return (before, after), where:
before is the content of inp up to (and not including) the first semicolon (or all of it if there is none)
after is the rest of the string:
- if
after is not empty, the first element is a semicolon
- regardless of what else happens,
before ++ after == inp
So to parse a list of statements separated by semicolons, I might do this:
parseStmts :: String -> Maybe [Stmt]
parseStmts inp = case break (== ';') inp of
(before, _ : after) -> -- ...
-- ^ before is the first statement
-- ^ ignore the semicolon
-- ^ after is the rest of the string
(_, []) -> -- inp doesn't contain any semicolons