[Haskell-cafe] Re: lift in TemplateHaskell?

Lyle Kopnicky lists at qseep.net
Tue Apr 14 17:59:40 EDT 2009


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 <lists at qseep.net> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090414/ff9ce3ac/attachment-0001.htm


More information about the Haskell-Cafe mailing list