I have
stringparse = mstring
<$> char '"'
<*> (many alphaNum <|> many space)
<*> char '"'
where mstring a b c = [a] ++ b ++ [c]
When I do,
parse stringparse "" "\"hello\"
I get Right "\"hello\""
When I do,
parse stringparse "" "\"\""
I get Right "\"\""
But when I do,
parse stringparse "" "\" \""
or parse stringparse "" "\"he llo\""
it does not work.
I get errors,
Left (line 1, column 2):
unexpected " "
expecting letter or digit or "\""
and
Left (line 1, column 4):
unexpected " "
expecting letter or digit or "\""
respectively.
I don't understand why the code does not parse spaces properly.