I'm pleased to announce alex-meta and happy-meta! These libraries provide quasi-quoter frontends and Template Haskell backends to the Alex lexer generator and the Happy parser generator respectively. Usage is something like this:

{-# Language QuasiQuotes #-}
module LexParse where

import Text.Alex.Quote
import Text.Happy.Quote

compileAlex [$alex|
<ALEX CODE HERE>
|]

compileHappy [$happy|
<HAPPY CODE HERE>
|]

With a bit of luck, the module will contain everything that alex and happy would generate from these scripts. I say with a bit of luck because these libraries haven't really been tested except on a few auto-generated alex/happy scripts (specifically those produced by the BNF Converter).

Issues:

* The libraries depend on haskell-src-meta to parse the output of alex/happy and translate it to TH. This means that the libraries are only compatible with lexers and parsers that don't generate code outside the scope of this library.

* Currently the libraries contain copies of most of the alex/happy source code, hopefully in the future the alex/happy packages can expose a few modules as libraries or the core of alex/happy can be factored out into a third library (used by both these libraries and the programs). 

Best regards
Jonas Duregård