[Haskell-cafe] [Parsec] A combinator to match between M and N times?
bortzmeyer at nic.fr
Tue Aug 29 09:05:39 EDT 2006
Parsec provides "count n p" to run the parser p exactly n times. I'm
looking for a combinator "countBetween m n p" which will run the
parser between m and n times. It does not exist in Parsec.
Much to my surprise, it seems quite difficult to write it myself and,
until now, I failed (the best result I had was with the "option"
combinator, which unfortunately requires a dummy value, returned when
the parser fails).
Does anyone has a solution? Preferrably one I can understand, which
means not yet with liftM :-)
More information about the Haskell-Cafe