RE: instance of Lift for Exp

"Simon Peyton-Jones" <[email protected]>
Newsgroups gmane.comp.lang.haskell.template
Message-ID <4B93206CA3C55D4F96A61C9B1DC80DE301652C75@EUR-MSG-03.europe.corp.microsoft.com>
Thanks for the offer.

Has anyone else encountered a need for this?  Duncan, would you like to
give some motivating examples?  For the present, I'm inclined to leave
it as a user library.

Simon

| -----Original Message-----
| From: [email protected]
[mailto:[email protected]] On
| Behalf Of Duncan Coutts
| Sent: 08 June 2004 19:45
| To: Template Haskell List
| Subject: [Template-haskell] instance of Lift for Exp
| 
| 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.