[Haskell-cafe] Why doesn't TH expose its parser?

Christopher Done chrisdone at gmail.com
Fri Feb 13 23:18:34 UTC 2015


On 13 February 2015 at 23:36, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> | What's the reason that there isn't a parseExp :: String -> Q Exp,
> | parseDecl, etc.?
>
> Good idea!  I don't think it'd be too hard.  The parser (in parser/Parser.y) already exposes parseExpression, parseDeclaration etc.  But they generate HsSyn and we need TH syntax.  We don’t currently have a way to do that.  It's (B) in https://ghc.haskell.org/trac/ghc/wiki/TemplateHaskell/Conversions
>
> So there's some refactoring work to do here.  Fiddly but not hard.

Awesome! I wasn't sure whether I wasn't taking into account a subtle
stage restriction problem somehow. Nice diagram. :-)

I'm looking at the TH implementation to see whether this is something
I can reasonably tackle.

Cheers!


More information about the Haskell-Cafe mailing list