Hi all, the Exp type is not an instance of the Lift class. This is the sensible thing most of the time so that you do not lift an expression when you meant to splice it instead. However in my experience it's sometimes useful (particularly when writing code that generates code), so attached is a module which makes it an instance. Like Text.Show.Functions, you should only import it if you want it, not import it by default. If people find this useful, I'd be quite happy to have it added to the standard GHC TH libs. I've named it Language.Haskell.TH.LiftExp and released it under GHC's BSD-style licence. Issues: * At the moment it also exports instances for Ratio, Maybe, PackedString, (,) and (,,). In my opinion these instances should be exported from Language.Haskell.TH already in which case they could be deleted from this module. (Exporting the instance for PackedString and Ratio is not strictly necessary and perhaps not desirable.) * The encoding for unboxed integers is not pleasant. (Unboxed Ints are used in the definition of Name). If anyone can find a more straightforward encoding please tell me. Duncan
participants (1)
-
Duncan Coutts