[web-devel] Hamlet variable interpolation syntax [previously: A few questions about Yesod]

Michael Snoyman michael at snoyman.com
Fri Dec 31 06:43:09 CET 2010

On Fri, Dec 31, 2010 at 3:45 AM, Mark Bradley <barkmadley at gmail.com> wrote:
> On Fri, Dec 31, 2010 at 11:58 AM, Felipe Almeida Lessa
> <felipe.lessa at gmail.com> wrote:
>> On Thu, Dec 30, 2010 at 6:45 PM, Michael Snoyman <michael at snoyman.com> wrote:
>>> I'm beginning to lean that direction as well. As far as forall/maybe
>>> syntax, I propose adding a comma:
>>> $forall foo bar baz, bin
>> What about something like
>> $forall bin <- foo bar baz
> I like this syntax, but the comma also works for me.

I too could go either way, and neither is particularly complicated to implement.

A separate question, since it's bugged me for a bit now: there's a
minor inconsistency, since maybe is paired with nothing. In theory, it
should be just/nothing. However, it still "feels" like maybe is a
better choice, though this could just be because I got used to it. Any
other thoughts?

>> We could even support pattern matches, which would be very useful on some cases:
>> $forall Person name age address <- people
>> I know, I know, bad example, it's just to get the idea across. =)
> I know it is possible, but the difficulty of bringing in more haskell
> features into hamlet is that hamlet's interpreter is written from
> scratch.  So unless someone gets an itch to grab a chunk of ghcs
> source code so we can run it at compile time in a template haskell
> context.  There has to be a better way than reinventing that wheel.

I concur on this one. The one place where I've really considered using
pattern match syntax is for tuples, which maybe *should* be
implemented now. With proper datatypes, the record accessors are
usually very clear.


More information about the web-devel mailing list