[web-devel] [Yesod] Creating a static link

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Sun Feb 13 16:46:43 CET 2011

On Sun, 13 Feb 2011 13:26:24 -0200, Rafael Cunha de Almeida <rafael-lists at kontesti.me> wrote:
> Michael Snoyman <michael at snoyman.com> disse:
> > You could go either way on that one. The content of an interpolation
> > is specifically *not* a fully-powered Haskell expression.
> Why is that? I have a little experience with RoR, there I could do
> something like this:
>     - @people.each do |person|
>         = person.name
> I think you don't want to have a fully-powered Haskell expression to
> avoid people adding too much code to the view (thinking in MVC pattern).
> However, it's not like people can't do it just because it's a little
> harder. Meanwhile, there are a lot of useful things that could be done
> if all (or most) haskell syntax was allowed to be interpolated.
> Instead of having special syntax like $forall, wouldn't it be better to
> just provide monad tranformers to allow for those sort of loops? 
> Something like Control.Monad.LoopWhile module provides. That way hamlet
> would need only to provide a ${} syntax that allow for adding haskell
> code which will be evaluated but won't print anything to the site. That
> way things could work a lot like in ruby, which I think makes things a
> lot simpler.
> Allowing for a new sort of interpolation and any sort of haskell
> expression to be interpolated, hamlet wouldn't need to create its own
> flow control statements. The user could write their views freely using
> only haskell syntax when code logic is required.

I join the question! I have some style-related constants in Style
module, e.g. sizes and colors. Then I want to do computations using
these constants in Cassius, something similar to SCSS. E.g. width:
#{Style.width1 + Style.width2} (not talking about appending "px" suffix
for now). Currently, because of artificial limitations on Hamlet
interpolations, I have to define (plus = (+)) (minus = (-)) and so
on. Would be nice if it allowed full-featured Haskell.


> []'s
> Rafael
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel

More information about the web-devel mailing list