[web-devel] Hamlet & Haml

Michael Snoyman michael at snoyman.com
Mon Apr 12 02:14:15 EDT 2010

On Sun, Apr 11, 2010 at 10:53 PM, Gour <gour at gour-nitai.com> wrote:

> Hello!
> Many/Some RoR folks swear at Haml/Sass (http://haml-lang.com/) and I
> see there is Hamlet project at Github
> (http://github.com/snoyberg/hamlet)
> saying "Haml-like template files that are compile-time checked", so
> I'm curious if it targets to be Haml-compatible or just "haml-like" ?
> Sincerely,
> Gour

Funny to see this mentioned right now; I'm in the middle of incorporating it
into Yesod. It's most definitely haml-like: haml itself allows embedding of
arbitrary Ruby code, so that's not really something I'm interested in here.

I'll put up a mini tutorial on it when it's polished, but there's really not
much to the syntax. Just to give an idea of the niche it's trying to fill:

* Quasi-quoted templates are embeddable directly in your Haskell files and
included in the binary.
* All variables are compile-time checked.
* Allows for on-demand loading of IO values, eg you can have conditionals in
the template and only load data from a database if needed.
* It uses enumerators for looping, so it should fit nicely in memory.
* Deals with the string problem by having a very simple datatype: data Html
= Encoded Text | Unencoded Text (Html will probably be renamed to something
* Has a monadic interface so you can use the nice features of the Hamlet
monad without using the Hamlet syntax and quasi-quoter.
* Allows embedding of other templates.

The code for integration into Yesod is literally being written right now
(just took a break to check my e-mail), so I should have more to say soon.
If anyone's dying to know the details, send me an e-mail and I'll try to put
together a blog post.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100412/e7583f87/attachment.html

More information about the web-devel mailing list