[Haskell-cafe] A simple attoparsec question
daniel.is.fischer at googlemail.com
Tue Mar 1 23:06:53 CET 2011
On Tuesday 01 March 2011 22:15:38, Robert Clausecker wrote:
> I hope, you understand my question.
Not sure. If I understand correctly, if you have
someParser = foo
and invoke someParser on something like
it tries baz and quux but you want it to fail without trying those?
How catastrophic should the failure be?
manyTill (notChar '\n') (char '"' <|> (char '\n' >> error "Newline"))
would be simple but rather extreme.
Since the point of (<|>) is that the second parser is tried upon failure of
the first, I don't see how you could avoid that with less drastic measures,
so you'd have to return a pseudo-success for malformed string literals and
check for that after someParser.
More information about the Haskell-Cafe