Hamlet is Born

April 20, 2010

GravatarMichael Snoyman

The past few weeks have seen a lot of changes to Yesod. As many of you know, my approach to Yesod is to split up as much functionality as possible into separate packages. Well, one of these has just matured into a first release: Hamlet 0.0.0 has been released.

By itself, Hamlet is a Haml-like language for writing templates. Templates are fully parsed at compile time via quasi-quotation, so you avoid a lot of the issues in dynamic templating systems. I'd like to think that this would be a natural fit for Haskell.

In the context of Yesod, I'm allowing Hamlet to replace two separate components: Data.Object.Html no longer exists, and there will be no HTML-like datatype. I feel good about this, since I was essentially recreating the (x)html libraries. There is an HtmlContent datatype, which is used to avoid a lot of the string escaping issues.

Additionally, I've dropped direct support for HStringTemplate. It will still be supported in the sense that any function can be used to generate content, but I don't intend to provide helper functions, as these would introduce a dependency on HStringTemplate.

I'm using Hamlet now throughout the Yesod codebase, and everything seems to be working just fine. There is a fairly comprehensive test suite, and a Hamlet section on the Yesod documentation site. I've tried to release this early as there seemed to be a fair amount of community interest, and I'd like to get the feedback sooner rather than later.

I'm sure there are lots of features that people would like to see in here, and I'd be happy to discuss adding them! At the same time, I want to avoid creating anything complicated here, so hopefully we'll find a good balance between features and confusion.

Comments

comments powered by Disqus

Archives