Tuesday, June 8, 2010

Heist 0.2 Released

Yesterday I released version 0.2 of the Heist XML templating library. This release makes some significant API changes, so it may break existing applications. But if you're only using Heist for basic templating, then you probably won't have to change anything. However, http://snapframework.com uses Heist extensively; and it did not require any code changes to upgrade. Here is a summary of what changed in 0.2:
  • String substitution in attributes
  • Support for DOCTYPE in templates
  • New implementation for TemplateMonad
  • Windows support
  • Typeable instance
  • Documentation improvements
  • Bug fixes

The biggest new feature in 0.2 is attribute string substitution. Because Heist's templating mechanism uses XML tags, it didn't automatically work for string substitution inside tag attributes. You don't have to do very much web development before you find yourself wanting this. Now you can get substitution in attributes using the syntax "$(name)". The Heist Tutorial describes this in more detail.

Previously Heist did not allow DOCTYPE declarations inside its templates. This was caused by implementation details, but needed to be fixed. Now you can put DOCTYPEs in your templates. Heist removes the DOCTYPE and copies it into the rendered page. If it encounters more than one DOCTYPE while recursing through your templates, it will use the first one.

Thanks to help from Edward Kmett we have a complete rewrite of TemplateMonad internals in this release. Previously we were using RWST because Heist uses Reader and State functionality under the hood. The rewrite eliminates the unnecessary Writer overhead. In the process, we decided to make it more convenient to use TemplateMonad as a monad transformer. TemplateMonad now provides instances of the most common monad type classes, eliminating the need to use "lift" to access standard monad functionality in the inner monad. This will make it easier to use Heist with more complex monad stacks.

In addition to these improvements, our users also contributed Windows compatibility and a Typeable instance. The Typeable instance makes it possible to use Heist dynamically with the Hint runtime haskell interpreter. We love getting community contributions and hope to see more of them in the future.

For more information about Heist and the Snap Web Framework see http://snapframework.com.

No comments: