From oleg@pobox.com Wed Mar 8 20:38:25 2006 From: oleg@pobox.com To: haskell@haskell.org Subject: [Haskell] Non-trivial transformations from the Haskell markup Date: Wed, 08 Mar 2006 17:37:43 -0800 Message-ID: <20060309013743.42C1FA9D0@Adric.metnet.navy.mil> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0929948750270160595==" --===============0929948750270160595== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The earlier message showed that Haskell as it is can represent semi-structured data with reasonable syntax, extensible set of `tags', and statically enforced content restrictions. This follow-up demonstrates non-trivial transformations of so marked-up data -- rendering data in HTML and RSS/XML. The resulting document has the structure different from that of the original markup: hierarchies may be flattened, some pieces of data rearranged among elements. Rendering of a particular markup element may be truly context sensitive, e.g., by pulling data from the parent element. Creating an RSS document further requires `subordinate' HTML rendering. We also demonstrate markup transformations by successive rewriting (aka, `higher-order tags') and the easy definition of new tags. Our running example is rendering change log data in HTML and RSS/XML.=20 This project has been inspired by Shae Matijs Erisson, who suggested I provide rss.xml feed for my site. You can see the ChangeLog in the master format and its two renderings at http://pobox.com/~oleg/ftp/ChangeLog.hs http://pobox.com/~oleg/ftp/ChangeLog.html http://pobox.com/~oleg/ftp/rss.xml The updated archive http://pobox.com/~oleg/ftp/Haskell/HSXML.tar.gz has the complete code. Here's a small example of the marked up semi-structured data/code in Haskell: > test_h =3D CLHead=20 > HeadAttrs { > ha_description =3D "list of updates to this whole site", > ha_DateRevision =3D (5,February,2006), > -- snipped > } > (updates > =20 > [update (5,February, 2006) > [ui (FileURLA "Computation/lambda-calc.html" "switch") > [[a [[code "switch"]]]] "in lambda-calculus"] > [ui (FileURLA "Haskell/types.html" "dependently-typed-append")= =20 > [[a "Dependently-typed" [[code "append"]]]]] > ] > ) Our document is made of a (heterogeneous!) sequence of update chunks; each chunk is a sequence of update elements, which contain the URL and additional markup. The corresponding HTML document looks like this

February 5, 2006