Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any Template Haskell tutorial for someone who doesn't know Lisp?

Tags:

I wanted to learn Template Haskell but all tutorials I find either assume that you learned lisp and know what lisp macros are, or that you know some cs theory jargon - things as splices, quasiquotations, etc... - or some theoretical results about macros.

I can't code a single line of lisp (and, though I intend to do this some day, I don't have the time to learn it right now). Haskell is my very first functional language and I learned it to the point that I can regularly code in it, use monads, applicative, understand the type system, etc... but I don't know much (also want to learn but I'm too stupid for it... :P) about the theoretical cs stuff behind it. So I'm oblivious to the jargon I typically find on TH tutorials.

So, the question is: is there a tutorial about TH for someone who code Haskell, not as a professional computer scientist, but just as a guy who uses programming for his daily chores, who learned Haskell as his first functional language? Maybe a introduction to macros and meta-programming that use TH as example?

Thanks all. :)

like image 957
Rafael S. Calsaverini Avatar asked Apr 20 '11 00:04

Rafael S. Calsaverini


2 Answers

No, I don't think there are any great introductory tutorials to Template Haskell. The best way to learn is to look at examples, or:

  • First stab at Template Haskell
  • The user's manual
  • Igloo's paper :: PS

I never found Lisp was a requirement, however there is terminology to learn, like for any domain-specific library.

like image 169
Don Stewart Avatar answered Sep 30 '22 02:09

Don Stewart


The best introductory tutorials to Template Haskell I know of are two documents by Bulat Ziganshin. The links from the Haskell Wiki seem to be broken at the moment, however you can access them via archive.org:

  • TH Tutorial
  • TH Documentation explanation
like image 33
John L Avatar answered Sep 30 '22 02:09

John L