How to parse an Integer with parsec
问题 I was expecting to find a function integer :: Stream s m Char => ParsecT s u m Integer or maybe even natural :: Stream s m Char => ParsecT s u m Integer in the standard libraries, but I did not find one. What is the standard way of parsing plain natural numbers directly to an Integer ? 回答1: Here is what I often do is to use the expression read <$> many1 digit which can have type Stream s m Char => ParsecT s u m Integer (or simply Parser Integer ). I don’t like the use of the the partial