
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/1.0.1.2/doc/html/sr... 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/# 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@haskell.org http://www.haskell.org/mailman/listinfo/beginners