[Haskell-cafe] Obtaining location of subexpressions from Template Haskell

Alejandro Serrano Mena trupill at gmail.com
Tue Oct 18 12:53:28 UTC 2016

Dear Haskell-café,
I am trying to write a small TH module which manipulates Haskell code.
Basically, I have a function `transform :: Exp -> Q Exp` which I call this
> g = $(transform [| map (+1) [1,2,3] |])
Since this is a source-to-source transformation, I would like to generate
also {-# LINE ... #-} pragmas to point any error back to their original
My question is: is there any way to obtain the location of sub-expressions
inside a `Exp` or `Q Exp`?

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161018/b882a481/attachment.html>

More information about the Haskell-Cafe mailing list