Proposal: liftData for Template Haskell

Richard Eisenberg eir at cis.upenn.edu
Fri Apr 17 20:26:24 UTC 2015


+1

But don't remove Lift. I need it to be able to lift types that have unlifted(*) data.

(*): Of course, the "lift" root of the word unlifted is entirely unrelated to the use of "lift" earlier in the same sentence. Urgh.

Good idea!
Richard

On Apr 17, 2015, at 7:21 AM, "Edward Z. Yang" <ezyang at mit.edu> wrote:

> I propose adding the following function to Language.Haskell.TH:
> 
>    -- | 'liftData' is a variant of 'lift' in the 'Lift' type class which
>    -- works for any type with a 'Data' instance.
>    liftData :: Data a => a -> Q Exp
>    liftData = dataToExpQ (const Nothing)
> 
> I don't really know which submodule this should come from;
> since it uses 'dataToExpQ', you might put it in Language.Haskell.TH.Quote
> but arguably 'dataToExpQ' doesn't belong in this module either,
> and it only lives there because it is a useful function for defining
> quasiquoters and it was described in the quasiquoting paper.
> 
> I might propose getting rid of the 'Lift' class entirely, but you
> might prefer that class since it doesn't go through SYB (and have
> the attendant slowdown).
> 
> This mode of use of 'dataToExpQ' deserves more attention.
> 
> Discussion period: 1 month
> 
> Cheers,
> Edward
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



More information about the Libraries mailing list