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

Brent Yorgey byorgey at seas.upenn.edu
Wed Jul 4 04:33:04 CEST 2012


On Wed, Jul 04, 2012 at 03:10:59AM +0100, 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
> /todoTodosR  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.

It does kind of look like a list comprehension, but it's actually
entirely unrelated -- it's quasiquotation:

http://www.haskell.org/haskellwiki/Quasiquotation

-Brent



More information about the Beginners mailing list