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

Jack Henahan jhenahan at uvm.edu
Wed Jul 4 04:30:58 CEST 2012

parseRoutes is a quasiquoter [1]. It uses a type-safe metaprogramming language called Template Haskell [2] to parse a string as a Route (e.g., HomeR is a Route describing the base resource). You can see the source here [3]. I'm pretty new with Yesod, myself, so I'm sure someone else will give you a more in depth description shortly.

[1]: http://www.haskell.org/haskellwiki/Quasiquotation
[2]: http://www.haskell.org/haskellwiki/Template_Haskell
[3]: http://hackage.haskell.org/packages/archive/yesod-routes/

On Jul 3, 2012, at 10:10 PM, Carlos J. G. Duarte 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/#
> |]
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120703/3f3913a6/attachment.pgp>

More information about the Beginners mailing list