Home
Publications
In the News

Events

GTTSE 2009
SQM 2009

Tools

2LT
CoddFish
XsdMetz
SdfMetz
MatchO

Strafunski

Related

Software Product Certification
Research at SIG


TFM Seminar
TFM group pages
PURé Café
PURe Project






www.flickr.com
This is a Flickr badge showing public photos from JstVssr. Make your own badge here.

This page explains how to create, customize, and use updatable pretty-printers in Haskell, using the support offered by the Sdf2Haskell? generator of Strafunski.

Background

Text.PrettyPrint.HughesPJ

The Haskell standard libraries come with a nice module of pretty-print combinators, originally devised by John Hughes and Simon Peyton-Jones (Text.PrettyPrint.HughesPJ). These combinators allow you to write a function of type X -> Doc to pretty-print values of type X to the abstract document type Doc. The obtained document of type Doc can subseqently be rendered to a String representation with a (parameterizable) render function.

Strafunski

Strafunski is a Haskell-based bundle for generic programming based on the notion of a functional strategy. A functional strategy is a function that is (i) generic, in the sense that it is applicable to values of any type, and (ii) updatable, in the sense that its generic behaviour can be specialized for specific types. For more info see the Strafunski home page.

Generic & updatable pretty-printers

On this page, we explain how Strafunski and pretty-printing combinators can be combined to allow one to construct pretty-printers that are:

  • generic, in the sense that they can pretty-print values of any type in a generic way,
  • updatable, in the sense that they can be customized with specific behaviour for values of specific types.

The solution involves a few additional combinators, that are available with Strafunski, and (optionally) some support from the Sdf2Haskell? generator, also available with Strafunski.

UNDER CONSTRUCTION

r1 - 15 Nov 2004 - 14:31:29 - JoostVisser
This site is powered by the TWiki collaboration platform Copyright © by the contributing authors. Ideas, requests, problems? Send feedback.
Syndicate this site RSSATOM