Scrap your boilerplate with XPath-like combinators

XML programming involves idioms for expressing 'structure shyness' such as the descendant axis of XPath or the default templates of XSLT. We initiate a discussion of the relationships between such XML idioms and generic functional programming, while focusing on the (Haskell-based) 'Scrap your boilerplate' style of generic programming (SYB). This work gives insight into mechanisms for traversal and selection. We compare SYB and XSLT. We approximate XPath in SYB. We make a case for SYB's programmability, when compared to XPath's fixed combinators. We allude to strengthened type checking for SYB traversals so as to reject certain, trivial behaviors.

[1]  Eelco Visser,et al.  Building program optimizers with rewriting strategies , 1998, ICFP '98.

[2]  Ralf Lämmel,et al.  Strongly typed heterogeneous collections , 2004, Haskell '04.

[3]  Shriram Krishnamurthi,et al.  SXSLT: Manipulation Language for XML , 2003, PADL.

[4]  Kurt Nørmark XML transformation in Scheme with LAML - a minimalistic approach: , 2003 .

[5]  Paolo Manghi,et al.  Types for path correctness of XML queries , 2004, ICFP '04.

[6]  Johan Jeuring,et al.  PolyP—a polytypic programming language extension , 1997, POPL '97.

[7]  Ralf Hinze,et al.  Type-indexed data types , 2004, Sci. Comput. Program..

[8]  Conor McBride Faking it: Simulating dependent types in Haskell , 2002, J. Funct. Program..

[9]  Ralf Lämmel,et al.  Strategic programming meets adaptive programming , 2003, AOSD '03.

[10]  Ralf Hinze,et al.  A new approach to generic functional programming , 2000, POPL '00.

[11]  Scott Boag,et al.  XQuery 1.0 : An XML Query Language , 2007 .

[12]  Boaz Patt-Shamir,et al.  Traversals of object structures: Specification and Efficient Implementation , 2004, TOPL.

[13]  Simon L. Peyton Jones,et al.  Scrap your boilerplate: a practical design pattern for generic programming , 2003, TLDI '03.

[14]  Colin Runciman,et al.  Haskell and XML: generic combinators or type-based translation? , 1999, ICFP '99.

[15]  Simon L. Peyton Jones,et al.  Template meta-programming for Haskell , 2002, Haskell '02.

[16]  Robert Richards,et al.  Document Object Model (DOM) , 2006 .

[17]  Oleg Kiselyov XML , XPath , XSLT implementations as SXML , SXPath , and SXSLT , 2002 .

[18]  Peter Thiemann,et al.  Functional logic overloading , 2002, POPL '02.

[19]  Gérard P. Huet,et al.  The Zipper , 1997, Journal of Functional Programming.

[20]  Peter Thiemann,et al.  A Functional Notation for Functional Dependencies , 2001 .