
Hello all, It looks like people are opposed to doing with the lift type-class. So here is a counterproposal: mark the Lift type class as overlappable, and define an instance: instance Data a => Lift a where ... This is fairly desirable, since GHC will sometimes generate a call to 'lift', in which case liftData can't be manually filled in. People can still define efficient versions of lift. Edward Excerpts from Edward Z. Yang's message of 2015-04-17 04:21:16 -0700:
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