Search code examples
haskellparsec

Haskell Parsec: primitive for greedy many?


I'm only just starting to learn the Parsec library, and I was wondering if there is any primitive in the library that can do the following: given a parser let a = char 'a', and a string aaab, would return Right ['a', 'a', 'a'], with "b" remaining, i.e., would parse as much as it can, but no more. I feel this is so necessary that it has to exist in some form or another in the library.


Solution

  • You want to use many a, which will parse as many a's as it can.