Sun, 22 Feb 2009
FP-Syd #12.
Last Thursday night was the 12th meeting of FP-Syd, the Sydney Functional Programming group and we had just under 20 people show up at the Sydney offices of Thoughtworks to hear our presenter.
Numbers were down a bit this month, probably because we only had one speaker. While we had a decent number of people volunteering to present when FP-Syd started it looks like we have, to a certain extent, pumped the well dry. The presentations committee is going to look into ways of encouraging more people to come forward and tell us what they're working on.
Anyway, our presenter for the evening was Tim Docker, talking about his Haskell graphing library Graphics.Rendering.Chart which is also on Hackage.
Tim started off with a demo of what the library could do and explained how it was built on top of hscairo the Haskell bindings to the very wonderful Cairo library as well as Gtk2Hs, the Haskell bindings to GTK. He then went on to discuss the difficulties of building a generic graphing library and of creating an API that exposes all the various features in an as-easy-as-possible to use way.
Internally, Tim's library uses Haskell data types and records, often with ten or more separate fields, in addition to having types and records nested within types and records. He went on to explain that accessing these deep and wide structures in Haskell was painful. In particular, the problems are:
- Field names must be unique with a module.
- "Updates" (creating a new record from an old one with one or more fields changed) have a special syntax.
- The special syntax for these updates doesn't allow composition, making updating of one field deep in a nested structure difficult.
Tim's solution to this problem was the use of the data-accessor library and Template Haskell for automatic generation of accessors. While this was an adequate solution, Tim felt that it was working around a limitation inherent to the Haskell language.
Finally, Tim spoke about making his Charts library extensible using Higher Order Functions.
A big thanks goes to Nick Carroll and Thoughtworks for making their facilities available for FP-Syd for the last 4 or 5 meetings. The next FP-Syd meeting will be a Google's new head quarters in Pyrmont. Thanks also to Tim for the presentation.