[web-devel] Hamlet and functions that take multiple arguments

Michael Snoyman michael at snoyman.com
Wed Jul 21 00:41:35 EDT 2010


On Wed, Jul 21, 2010 at 4:17 AM, Mark Bradley <barkmadley at gmail.com> wrote:

> hamlet doesn't appear to support functions that take more than one
> argument.
>
> i.e.
>
> fun f x = [$hamlet| ^template.f.x^ |]
>
> produces the call template (f x)
>
> is there some way to make hamlet produce (template f) x?
>

Unfortunately not. It's not any *technical* limitation in Hamlet, just that
I can't think of a good, intuitive syntax for it. The way that I work around
this is by defining variables in a where clause, eg

fun f x = [$hamlet|^templateTmp^|] where templateTmp = template f x

If you have better ideas, I'm open to hearing them ;).

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20100720/0406bc7a/attachment.html


More information about the web-devel mailing list