When a parser result is Partial, previously the eitherResult function showed a generic error message that includes no useful information other than a generic "incomplete input" message.
For example, if we let
p = (,) <$> letter <*> digit <?> "thing"
then
eitherResult (parse p "a") = Left "Result: incomplete input"
Attoparsec is already capable of generating more informative error information for this example, as we can demonstrate by using parseOnly:
parseOnly p "a" = "thing > digit: not enough input"
This change brings that same error message to eitherResult by simply feeding mempty into the continuation. With this change, eitherResult now gives the same output as parseOnly.
eitherResult (parse p "a") = "thing > digit: not enough input"
When a parser result is
Partial
, previously theeitherResult
function showed a generic error message that includes no useful information other than a generic "incomplete input" message.For example, if we let
then
Attoparsec is already capable of generating more informative error information for this example, as we can demonstrate by using
parseOnly
:This change brings that same error message to
eitherResult
by simply feedingmempty
into the continuation. With this change,eitherResult
now gives the same output asparseOnly
.