[web-devel] Re: Runtime Hamlet template parsing/rendering

Michael Snoyman michael at snoyman.com
Sun Aug 8 01:28:39 EDT 2010

On Fri, Aug 6, 2010 at 2:06 PM, Michael Snoyman <michael at snoyman.com> wrote:

> On Fri, Aug 6, 2010 at 3:13 AM, Simon Michael <simon at joyful.com> wrote:
>> On 8/5/10 12:57 AM, Michael Snoyman wrote:
>> > Thanks for the input everyone. I've just pushed the new Hamlet runtime
>> code to github[1]. Instead of using data-object,
>> > I've created a new datatype: HamletData[2]. Runtime templates support
>> *almost* the entirety of valid Hamlet documents;
>> Excellent! With the following kludgery I was able to change hamlet files
>> and see the effect immediately. A boon for development. Useful parse errors
>> in the browser too. It's not all smooth of course. Including other hamlets
>> and integrating RT and non-RT hamlets seems a lot of work.
>> It's true that none of this interoperation will be automatic, but it's
> possible. Regarding: including other hamlets, you just need to parse them
> first and then include them in your HamletData. Regarding integrating RT and
> non-RT: I would say your best bet it to do that via Html (). In other words,
> apply the template to the URL rendering function, resulting in a Html ()
> value, and then embed that in the template you desire.
> For the moment, RT templates are definitely second-class citizens, but if
> people have ideas of how to improve them, I'd be happy to hear it.
> Michael

I had a sudden inspiration yesterday of how to improve runtime Hamlet
templates. This should give you a lot of the benefits of compile-time
templates without requiring a recompile for every change. I've written this
up in a blog post[1].


[1] http://www.snoyman.com/blog/entry/typesafe-runtime-hamlet/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100808/03d8b7bf/attachment.html

More information about the web-devel mailing list