[Haskell-beginners] What's this [f| data |] ??

David McBride toad3k at gmail.com
Wed Jul 4 04:32:28 CEST 2012

This is quasiquoting.  It is a pretty advanced topic, but it allows
you to take an arbitrary string and parse it with a quasiquoter of
your choice (in this case, parseRoutes) into some structure or
another.  Yesod uses it all over the place to generate html,
javascript, routing tables, and such.

On Tue, Jul 3, 2012 at 10:10 PM, Carlos J. G. Duarte
<carlos.j.g.duarte at gmail.com> wrote:
> Hi. I'm trying to get into haskell in my free time. I have already covered
> some syntax, but there's plenty to do yet, and when I'm consulting other
> people's stuff, I find lots of unknown constructs to me, which turns harder
> to lookup for, due to the very "symbolic" nature of Haskell.
> For instance, on this http://www.yesodweb.com/blog/2012/04/yesod-js-todo
> they have a few constructs like this:
> mkYesod "App" [parseRoutes|
> / HomeR GET
> /todo TodosR GET PUT
> /todo/#TodoId TodoR GET DELETE
> |]
> It seems that the inline text is going to be fed to parseRoutes. How does
> that constructs work (links?)? I already know list comprehensions which
> appear to be related with this.
> Thanks.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list