[Haskell-cafe] integrating Happy & Alex monads

Richard Cobbe cobbe at ccs.neu.edu
Thu Dec 26 20:08:39 UTC 2013


I'm working on a program in which I'd like to use Alex and Happy to parse
the input.  I've written the scanner, and it uses Alex's "monadUserState"
wrapper to track source location and various other things.  Now, the
problem is to integrate it with the parser.  As far as I can tell from
reading the Happy documentation, I need to use a monadic Parser in Happy as
well, but the manuals don't relaly provide a lot of information about how
to integrate the two.  And I haven't really been able to find many examples
of this either.  Lots of folks cite "the Haskell parser", although I'm not
sure which implementation that's referring to.  I did check out the GHC
source, and while it contains an Alex parser specification, it doesn't look
like anything actually *uses* this, preferring instead a handwritten
parser.

Could anyone point me to a discussion of how to integrate these two tools,
or examples of places where folks have done this before?

Thanks much,

Richard


More information about the Haskell-Cafe mailing list