Hi
I was wondering if it was possible to write a function that allows changing
the state type of the Parser monad from Parsec.
The full parser type is: GenParser p s a, where p is the token type, s is the
state type and a is the return type of the monad. However, I mostly use
CharParser s a
In a local copy of Parsec.Prim I've added:
mapState :: (st1 - st2) - State tok st1 - State tok st2
mapState f (State i p u) = State i p $ f u
mapOkReply :: (st1 - st2) - Reply tok st1 a - Reply tok st2 a
mapOkReply _ (Error a) = Error a
mapOkReply f (Ok a s e) = Ok a (mapState f s) e
mapConsumed