I'm trying to write a parser using the parsers
package using do
syntax. Here is an example:
{-# LANGUAGE ApplicativeDo #-}
import Text.Parser.Char (string, spaces)
import Text.Parser.Token (TokenParsing, natural)
issueParser :: TokenParsing p => p Integer
issueParser = do
spaces
string "**Issue:**"
spaces
string "https://github.com" <|> string "github.com"
string "/commercialhaskell/stack/issues/"
natural
The error GHC gives me is Could not deduce (Monad p) arising from a do statement from the context: TokenParsing p
. This error message is correct that TokenParsing
does not provide Monad
as a super class, however it does provide Applicative
which means because I have this language extension turned on, I should be able to use the do
syntax with just Applicative
. What am I doing wrong/missing here?