The error message can be improved in your examples by using count 5
instead of many1.
C.
Am 08.08.2012 21:24, schrieb silly:
I am trying to create a parsec parser that parses an integer and then
checks if that integer has the right size. If not, it generates an
error.
I tried the
On Thu, Aug 9, 2012 at 3:59 AM, Christian Maeder
christian.mae...@dfki.de wrote:
The error message can be improved in your examples by using count 5
instead of many1.
Yes, I know. That's what I ended up doing. But this is an ad hoc
solution. I think parsec should offer a more general solution.
On 12-08-08 03:24 PM, silly wrote:
The problem is that when I try this
parse integer 7
I get the following error:
Left (line 1, column 6):
unexpected end of input
expecting digit
integer overflow
ie there are three error messages but I only want the last one. Is
there something I
I am trying to create a parsec parser that parses an integer and then
checks if that integer has the right size. If not, it generates an
error.
I tried the following:
8---
import Text.Parsec
import Text.Parsec.String
integer :: Parser
I found a similar question asked in June 2009 on the haskell-beginners
archives, titled Clearing Parsec error messages. A hack that was proposed
(http://www.haskell.org/pipermail/beginners/2009-June/001809.html) was to
insert a dummy character into the stream, consume it, and then fail. Still,
Inserting a character into the stream can be expensive if for example
the stream is a ByteString.
I tried the following crazy solution and it seems that it works:
succeed :: Parser ()
succeed = mkPT $ \st -
return $ Consumed $ return $ Ok () st $ unknownError st
succeed is a parser that
On Wed, Aug 8, 2012 at 8:26 PM, silly silly8...@gmail.com wrote:
Inserting a character into the stream can be expensive if for example
the stream is a ByteString.
I tried the following crazy solution and it seems that it works:
succeed :: Parser ()
succeed = mkPT $ \st -
return $