[Haskell-beginners] parsec, return remaining input?
Daniel Fischer
daniel.is.fischer at googlemail.com
Sat Apr 16 02:01:35 CEST 2011
On Saturday 16 April 2011 01:44:32, Rob Nikander wrote:
> Hi,
>
> Is there a way to return the remaining input, so that parsec can be
> used to parse one piece at a time. So something like:
>
> chunk = many (noneOf ",:")
chunk = do
first <- many (noneOf ",:")
rest <- getInput
-- maybe `setInput ""' here
return (first, rest)
> parse chunk "abc,123:xyz"
But that looks like you're going to iterate, so maybe
sepBy (many $ noneOf ",:") (oneOf ",:")
should be looked at.
>
> Would return ("abc", ",123:last") or similar?
>
> thanks,
> Rob
More information about the Beginners
mailing list