
OK, I figured it out.
The class is Language.Haskell.TH.Syntax.Lift. The function is
Language.Haskell.TH.Syntax.lift. And I can rewrite my function as:
let double n = [| 2 * n |]
I wish this were explained in the TemplateHaskell documentation.
- Lyle
On Tue, Apr 14, 2009 at 2:51 PM, Lyle Kopnicky
Hi folks,
I'm having trouble reading the TemplateHaskell docs and trying to do something that seems like it should be simple. In MetaML, there is a 'lift' function which does exactly what I want to do. Here's an example function:
let double n = [| 2 * $( litE (integerL n) ) |]
This works as intended, but instead of writing "litE (integerL n)" I just want to write "lift n", or something similar. I expect that would involve a type class called something like Liftable that would lift literals using the appropriate functions. Does this exist?
Thanks, Lyle