Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (52 sloc) 2.7 KB
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Template Haskell and Camlp4 Tutorial</title></head>
<body>
<h1 id='template_haskell_and_camlp4_tutorial'>Template Haskell and Camlp4 Tutorial</h1>
<p>Hi and welcome to the tutorial! Here are some local resources:</p>
<h2 id='ocaml'>OCaml</h2>
<ul>
<li><a href='doc/ocaml/Camlp4Ast.partial.ml.html'>AST type definition</a></li>
<li><a href='doc/ocaml/ast.html'>AST quotations</a></li>
<li><a href='doc/ocaml/revised.html'>revised syntax</a></li>
<li><a href='doc/ocaml/Sig.ml.html'>library signatures</a></li>
<li><a href='doc/ocaml/Camlp4Ast2OCamlAst.ml.html'>Camlp4Ast2OCamlAst.ml</a></li>
<li><a href='doc/ocaml/Camlp4OCamlRevisedParser.ml.html'>Camlp4OCamlRevisedParser.ml</a></li>
<li><a href='doc/ocaml/Camlp4OCamlParser.ml.html'>Camlp4OCamlParser.ml</a></li>
</ul>
<p>Exercises:</p>
<ul>
<li><a href='exercises/ocaml/tuple_map/index.html'>Tuple map</a></li>
<li><a href='exercises/ocaml/zipper/index.html'>Zipper types</a></li>
<li><a href='exercises/ocaml/json_quot/index.html'>JSON quotations</a></li>
</ul>
<h2 id='haskell'>Haskell</h2>
<ul>
<li><a href='http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html'>TH Manual</a></li>
<li><a href='http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/template-haskell.html#th-quasiquotation'>QQ Manual</a></li>
<li><a href='http://hackage.haskell.org/cgi-bin/hackage-scripts/package/template-haskell'>TH API</a></li>
<li><a href='http://www.haskell.org/haskellwiki/Template_Haskell'>TH Wiki</a></li>
<li><a href='http://research.microsoft.com/en-us/um/people/simonpj/papers/meta-haskell/meta-haskell.pdf'>TH Paper</a></li>
</ul>
<p>Loading TH in GHCi:</p>
<p><code>GHCI&gt; :set -XTemplateHaskell</code></p>
<p>Hint to show code:</p>
<p><code>printQ :: Ppr a =&gt; Q a -&gt; IO ()</code></p>
<p><code>printQ x = putStrLn . pprint =&lt;&lt; runQ x</code></p>
<p>And then:</p>
<p><code>printQ [e| [42,43] |]</code></p>
<p>Exercises:</p>
<ul>
<li><a href='exercises/haskell/tuple/tuple.html'>Tuple map</a></li>
<li><a href='exercises/haskell/zipper/zipper.html'>Zipper types</a></li>
<li><a href='exercises/haskell/json-quot/json-quot.html'>JSON quotations</a></li>
</ul>
<h2 id='other'>Other</h2>
<ul>
<li><a href='doc/huet-zipper.pdf'>The Zipper (Huet)</a></li>
<li><a href='slides/cufp-metaprogramming-tutorial-slides.pdf'>Tutorial slides</a></li>
</ul>
</body></html>
Something went wrong with that request. Please try again.