[Haskell-beginners] Parsec newbie question
Patrick LeBoutillier
patrick.leboutillier at gmail.com
Mon Aug 31 13:33:48 EDT 2009
Hi all,
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,
Patrick
--
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090831/0508dd4d/attachment.html
More information about the Beginners
mailing list