我有
stringparse = mstring
<$> char '"'
<*> (many alphaNum <|> many space)
<*> char '"'
where mstring a b c = [a] ++ b ++ [c]
当我做,
parse stringparse "" "\"hello\"
我明白了Right "\"hello\""
当我做,
parse stringparse "" "\"\""
我明白了Right "\"\""
但当我这样做时,
parse stringparse "" "\" \""
或者parse stringparse "" "\"he llo\""
这没用。
我得到错误,
Left (line 1, column 2):
unexpected " "
expecting letter or digit or "\""
和
Left (line 1, column 4):
unexpected " "
expecting letter or digit or "\""
分别。
我不明白为什么代码不能正确解析空格。