[Haskell-cafe] Template Haskell.

Jason Dagit dagit at codersbase.com
Fri Nov 10 14:27:36 EST 2006


On 11/10/06, szefirov at ot.ru <szefirov at ot.ru> wrote:
> Why doesn't reify return function body?
>
> reify (mkName "somefunction") for a function defined in the same module
> returns constructor VarI (of data type Info) that does not contain
> function declaration in (Maybe Dec) part.
>
> What actions should I perform to get a function body with patterns,
> expressions and all that?

I'm not sure, but when faced a similar problem I used the Haskell98
parser to get at the AST of the functions.  In my case the functions
were defined in a different module so TH definitely couldn't get at
the internals.  The details of what I did are here:
http://blog.codersbase.com/2006/09/01/simple-unit-testing-in-haskell/

HTH,
Jason


More information about the Haskell-Cafe mailing list