[Haskell-beginners] Parsec newbie question
patrick.leboutillier at gmail.com
Mon Aug 31 13:33:48 EDT 2009
I'd like to use parsec to parse IP addresses. So far I've written a (tiny)
parser for bytes:
byte :: GenParser Char st Word8
byte = do
n <- many1 digit
return (read n)
The function works fine, but it accepts numbers greater than 255.
How do I encapsulate this condition in the parser so that it fails (with en
appropriate error message) in this case?
Thanks a lot,
Rosemère, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners