From simonpj at microsoft.com Fri Sep 1 07:41:49 2006 From: simonpj at microsoft.com (Simon Peyton-Jones) Date: Fri Sep 1 07:29:37 2006 Subject: [Template-haskell] Small TH demo: generating instances In-Reply-To: References: Message-ID: <036EAC76E7F5EC4996A3B3C3657D41160663DA7E@EUR-MSG-21.europe.corp.microsoft.com> I've tagged it on as an example in http://haskell.org/haskellwiki/Template_Haskell If you feel like it, you could inline more of your message, and attachments, into the Wiki page. Feel free to make other improvements! Simon | -----Original Message----- | From: template-haskell-bounces@haskell.org [mailto:template-haskell-bounces@haskell.org] On Behalf | Of Rene de Visser | Sent: 24 August 2006 20:43 | To: template-haskell@haskell.org | Subject: [Template-haskell] Small TH demo: generating instances | | I am hoping that this example is small, simple and well commented enough to | help people generate instances with TH. | | The instance generation is used to create instances to render haskell code | to TH code that generates the original haskell code. | | there is an example in Test.hs | | The instance generation function is in Base.hs. TH_Render.hs is where the | instances are derived. | | Rene. | From Rene_de_Visser at hotmail.com Fri Sep 1 12:44:48 2006 From: Rene_de_Visser at hotmail.com (Rene de Visser) Date: Fri Sep 1 12:33:19 2006 Subject: [Template-haskell] Re: Small TH demo: generating instances References: <036EAC76E7F5EC4996A3B3C3657D41160663DA7E@EUR-MSG-21.europe.corp.microsoft.com> Message-ID: "Simon Peyton-Jones" schrieb im Newsbeitrag I've tagged it on as an example in http://haskell.org/haskellwiki/Template_Haskell If you feel like it, you could inline more of your message, and attachments, into the Wiki page. Feel free to make other improvements! Hello Simon, Already done, it was the point above the one you added. I will combine the two entries together (I put the body on another page as I thought it would be too long). Rene. | -----Original Message----- | From: template-haskell-bounces@haskell.org [mailto:template-haskell-bounces@haskell.org] On Behalf | Of Rene de Visser | Sent: 24 August 2006 20:43 | To: template-haskell@haskell.org | Subject: [Template-haskell] Small TH demo: generating instances | | I am hoping that this example is small, simple and well commented enough to | help people generate instances with TH. | | The instance generation is used to create instances to render haskell code | to TH code that generates the original haskell code. | | there is an example in Test.hs | | The instance generation function is in Base.hs. TH_Render.hs is where the | instances are derived. | | Rene. | From avatar at hot.ee Sat Sep 9 11:31:09 2006 From: avatar at hot.ee (Misha Aizatulin) Date: Sat Sep 9 11:18:36 2006 Subject: [Template-haskell] Deriving Read with Template Haskell (Re: automatic instances for pretty printing and parsing) In-Reply-To: <434274F3.9070507@imn.htwk-leipzig.de> References: <434274F3.9070507@imn.htwk-leipzig.de> Message-ID: <4502DE3D.9020409@hot.ee> Johannes Waldmann wrote: > I use Text.PrettyPrint.HughesPJ and > Text.ParserCombinators.Parsec heavily so I made > some DrIFT rules for deriving the "obvious" instances for > > class ToDoc a where toDoc :: a -> Doc > class Reader a where readerPrec :: Int -> Parser a > > Perhaps someone has solved a similar problem before. I was looking for the same thing because I didn't like the way derived instances of Read depend on whether I define my datatypes in prefix, infix or record form. I ended up writing my own Read derivation using Template Haskell. Here it is. Basically it can read prefix, infix or record syntax where applicable. It is based on ReadPrec, not Parsec though. Some further notes and questions: 1. Instead of Read I actually use another class, Parse, which is a clone of Read. The reason is that I wanted to have new instances for some standard types that already have their Read instances defined. This introduces some hackery and requires you to use -fallow-overlapping-instances. If you don't like it, it should be quite easy to go back to Read. 2. My instance context derivation is very primitive: I simply repeat all the field types in the context, say > data T a b = T1 Int | T2 (a b) (Maybe b) > instance (Parse Int, Parse (a b), Parse (Maybe b)) => Parse (T a b) The result is that you need -fallow-undecidable-instances to chew through all that :) Here a question: are there any pitfalls about writing such instances that I don't currently see? Any feedback, improvements, fixes, etc. always welcome! Cheers, Misha -------------- next part -------------- A non-text attachment was scrubbed... Name: testDeriveParse.hs Type: text/x-haskell Size: 1125 bytes Desc: not available Url : http://www.haskell.org//pipermail/template-haskell/attachments/20060909/64abd77e/testDeriveParse.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: DeriveParse.hs Type: text/x-haskell Size: 5142 bytes Desc: not available Url : http://www.haskell.org//pipermail/template-haskell/attachments/20060909/64abd77e/DeriveParse.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: Parse.hs Type: text/x-haskell Size: 2105 bytes Desc: not available Url : http://www.haskell.org//pipermail/template-haskell/attachments/20060909/64abd77e/Parse.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TypeInfo.hs Type: text/x-haskell Size: 2123 bytes Desc: not available Url : http://www.haskell.org//pipermail/template-haskell/attachments/20060909/64abd77e/TypeInfo.bin From visser at cs.uu.nl Tue Sep 12 05:46:48 2006 From: visser at cs.uu.nl (Eelco Visser) Date: Tue Sep 12 05:33:52 2006 Subject: [Template-haskell] Second CFP: Partial Evaluation and Program Manipulation (PEPM'07) Message-ID: <1158054408.5138.13.camel@stratego.cs.uu.nl> ---------------------------------------------------------------------- Second Call For Papers ACM SIGPLAN 2007 Workshop on PARTIAL EVALUATION AND PROGRAM MANIPULATION (PEPM'07) Nice, France January 15-16, 2007 (Co-located with POPL 2007) http://www.program-transformation.org/PEPM07 ---------------------------------------------------------------------- The PEPM Symposium/Workshop series aims to bring together researchers and practitioners working in the areas of program manipulation, partial evaluation, and program generation. PEPM focuses on techniques, theory, tools, and applications of analysis and manipulation of programs. The 2007 PEPM workshop will be based on a broad interpretation of semantics-based program manipulation and continue last year's successful effort to expand the scope of PEPM significantly beyond the traditionally covered areas of partial evaluation and specialization and include practical applications of program transformations such as refactoring tools, and practical implementation techniques such as rule- based transformation systems. In addition, the scope of PEPM covers manipulation and transformations of program and system representations such as structural and semantic models that occur in the context of model-driven development. In order to reach out to practitioners, a separate category of tool demonstration papers will be solicited. ---------------------------------------------------------------------- Topics of interest for PEPM'07 include, but are not limited to: + Program and model manipulation techniques such as transformations driven by rules, patterns, or analyses, partial evaluation, specialization, slicing, symbolic execution, refactoring, aspect weaving, decompilation, and obfuscation. + Program analysis techniques that are used to drive program/model manipulation such as abstract interpretation, static analysis, binding-time analysis, dynamic analysis, constraint solving, and type systems. + Analysis and transformation for programs/models with advanced features such as objects, generics, ownership types, aspects, reflection, XML type systems, component frameworks, and middleware. + Techniques that treat programs/models as data objects including meta-programming, generative programming, staged computation, and model-driven program generation and transformation. + Application of the above techniques including experimental studies, engineering needed for scalability, and benchmarking. Examples of application domains include legacy program understanding and transformation, domain-specific language implementations, scientific computing, middleware frameworks and infrastructure needed for distributed and web-based applications, resource-limited computation, and security. We especially encourage papers that break new ground including descriptions of how program/model manipulation tools can be integrated into realistic software development processes, descriptions of robust tools capable of effectively handling realistic applications, and new areas of application such as rapidly evolving systems, distributed and web-based programming including middleware manipulation, model-driven development, and on-the-fly program adaptation driven by run-time or statistical analysis. ---------------------------------------------------------------------- Submission Categories and Guidelines Regular research papers must not exceed 10 pages in ACM Proceedings style. Tool demonstration papers must not exceed 4 pages in ACM Proceedings style, and authors will be expected to present a live demonstration of the described tool at the workshop. Suggested topics, evaluation criteria, and writing guidelines for both research tool demonstration papers will be made available on the PEPM'07 web site. Papers should be submitted electronically via the workshop web site. The workshop proceedings will be published in the ACM Digital Library and selected papers will be invited for a journal special issue dedicated to PEPM'07. ---------------------------------------------------------------------- Important Dates + Abstracts due: October 18, 2006 + Submission: October 20, 2006 + Notification: December 1, 2006 + Camera-ready: December 18, 2006 + Workshop: January 15-16, 2007 ----------------------------------------------------------------------- Program Chairs * G. Ramalingam (Microsoft Research, Bangalore) * Eelco Visser (Delft University of Technology, The Netherlands) Program Committee Members * Ras Bodik (University of California, Berkeley, USA) * Albert Cohen (INRIA, France) * Jim Cordy (Queen's University, Canada) * Martin Erwig (Oregon State University, USA) * Bernd Fischer (University of Southampton, UK) * John Hatcliff (Kansas State University, USA) * Jan Heering (CWI, The Netherlands) * Dan Grossman (University of Washington, USA) * Annie Liu (State University of New York at Stony Brook, USA) * Jacques Noy? (?cole des Mines de Nantes/INRIA, France) * German Puebla (Technical University of Madrid, Spain) * Peter Sestoft (Royal Veterinary and Agricultural University, Denmark) * Yannis Smaragdakis (Georgia Tech, Atlanta, USA) * Walid Taha (Rice University, Houston, USA) -----------------------------------------------------------------------