I\'ve got the following, which type-checks:
p_int = liftA read (many (char \' \') *> many1 digit <* many (char \' \'))
Now, as the fu
You may find
Text-Megaparsec-Lexer.integer :: MonadParsec s m Char => m Integer
does what you want.
The vanilla parsec library seems to be missing a number of obvious parsers, which has led to the rise of "batteries included" parsec derivative packages. I suppose the parsec maintainers will get around to betteries eventually.
https://hackage.haskell.org/package/megaparsec-4.2.0/docs/Text-Megaparsec-Lexer.html
UPDATE
or with vanilla parsec:
Prelude Text.Parsec Text.Parsec.Language Text.Parsec.Token> parse ( integer . makeTokenParser $ haskellStyle ) "integer" "-1234"
Right (-1234)