Thursday, July 29, 2010

New version of the template library

Sometime in 2007 I wrote a small Haskell library for simple string substitution: given a string with placeholders, e.g. “Hi, $name!”, and a context that maps placeholders to values you can easily substitute the placeholders for the values.

After receiving some user feedback I’ve now updated the library and released version 0.2 on Hackage. Here's what's new in this release:

  • The String type has been replaced with the new Text type from the text library.
  • The API has been generalized to support more sophisticated error reporting, using an applicative functor interface.
  • The I/O API has been removed; use the I/O API in the text library API instead.
  • The context that maps placeholder to values can now be any function from keys to values, instead of just a Map.

Here’s a usage example:


Monday, July 12, 2010

High-performance Haskell tutorial at CUFP

I will be giving a tutorial on high-performance Haskell at CUFP 2010. Here’s the abstract:

Haskell makes it possible to write elegant, high-level code that rivals the performance of low-level, imperative languages. In this tutorial, I will introduce the tools Haskell provides for reasoning about the performance of your code and techniques that you can use to make your code faster. I will cover important topics in Haskell performance optimization, including:

  • accurate benchmarking,
  • CPU and memory profiling,
  • laziness and strictness,
  • making sense of compiler output,
  • performance idioms, and
  • data types and their impact on performance.

By the end of the tutorial you should have an understanding of how to accurately measure the performance of your Haskell program, determine which parts of the program needs improvement, and finally, improve the performance of the program.

Here’s the CUFP tutorial schedule.

The slides from the tutorial are now available.