This library of monadic parser combinators is based on the ones
defined by Graham Hutton and Erik Meijer. It has been extended by
Malcolm Wallace to use an abstract token type (no longer just a
string) as input, and to incorporate state in the monad, useful
for symbol tables, macros, and so on. Basic facilities for error
reporting have also been added, and later extended by Graham Klyne
to return the errors through an Either type, rather than just
calling error.

Apply the parser to some real input, given an initial state value.
If the parser fails, raise error to halt the program.
(This is the original exported behaviour - to allow the caller to
deal with the error differently, see papply'.)

Re-parsing

This is useful for recursively expanding macros. When the
user-parser recognises a macro use, it can lookup the macro
expansion from the parse state, lex it, and then stuff the
lexed expansion back down into the parser.