<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    No special magic. Just make sure you get the th-new branches of ghc,<br>
    libraries/template-haskell, and testsuite.<br>
    <br>
    If you hit any snags let me know---happy to help you get running.<br>
    <br>
    Geoff<br>
    <br>
    On 05/17/2013 07:12 PM, Jacques Carette wrote:<br>
    <span style="white-space: pre;">&gt; Fantastic!  I will definitely
      be trying it out early next week.<br>
      &gt;<br>
      &gt; Are there any special instructions regarding how to compile
      this<br>
      &gt; branch?  I will work on adding test cases, which would be
      translations<br>
      &gt; of larger metaocaml programs.<br>
      &gt;<br>
      &gt; Jacques<br>
      &gt;<br>
      &gt; On 13-05-16 11:21 AM, Geoffrey Mainland wrote:<br>
      &gt;&gt; I have pushed a new branch, th-new, that partially
      implements the<br>
      &gt;&gt; proposal outlined in Simon PJ's "New directions for
      Template Haskell"<br>
      &gt;&gt; post at:<br>
      &gt;&gt;<br>
      &gt;&gt;
      <a class="moz-txt-link-freetext" href="http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal">http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal</a><br>
      &gt;&gt;<br>
      &gt;&gt; The main missing features are top-level pattern splices
      and local<br>
      &gt;&gt; declaration splices.<br>
      &gt;&gt;<br>
      &gt;&gt; Typed expression quotations and typed expression splices
      *are*<br>
      &gt;&gt; implemented. Syntax is as in Simon's original proposal:
      [|| ||] for<br>
      &gt;&gt; typed expression brackets and $$(...) for typed
      expression splices. One<br>
      &gt;&gt; can now write:<br>
      &gt;&gt;<br>
      &gt;&gt; power :: Int -&gt; TExp (Int -&gt; Int)<br>
      &gt;&gt; power n = [|| \x -&gt; $$(go n [|| x ||]) ||]<br>
      &gt;&gt; where<br>
      &gt;&gt; go :: Int -&gt; TExp Int -&gt; TExp Int<br>
      &gt;&gt; go 0 x = [|| 1 ||]<br>
      &gt;&gt; go n x = [|| $$x * $$(go (n-1) x) ||]<br>
      &gt;&gt;<br>
      &gt;&gt; In fact, one can even write:<br>
      &gt;&gt;<br>
      &gt;&gt; power :: Num a =&gt; Int -&gt; TExp (a -&gt; a)<br>
      &gt;&gt; power n = [|| \x -&gt; $$(go n [|| x ||]) ||]<br>
      &gt;&gt; where<br>
      &gt;&gt; go :: Num a =&gt; Int -&gt; TExp a -&gt; TExp a<br>
      &gt;&gt; go 0 x = [|| 1 ||]<br>
      &gt;&gt; go n x = [|| $$x * $$(go (n-1) x) ||]<br>
      &gt;&gt;<br>
      &gt;&gt; Writing the following<br>
      &gt;&gt;<br>
      &gt;&gt; f :: TExp Char -&gt; TExp Integer<br>
      &gt;&gt; f x = [|| $$x * 3 ||]<br>
      &gt;&gt;<br>
      &gt;&gt; gives the error<br>
      &gt;&gt;<br>
      &gt;&gt; Main.hs:28:7:<br>
      &gt;&gt; Couldn't match type ‛Char’ with ‛Integer’<br>
      &gt;&gt; Expected type: TExp Integer<br>
      &gt;&gt; Actual type: TExp Char<br>
      &gt;&gt; In the Template Haskell quotation [|| $$x * 3 ||]<br>
      &gt;&gt; In the expression: [|| $$x * 3 ||]<br>
      &gt;&gt; In an equation for ‛f’: f x = [|| $$x * 3 ||]<br>
      &gt;&gt;<br>
      &gt;&gt; The th-new branch of ghc has accompanying branches for
      template-haskell<br>
      &gt;&gt; and testsuite, both named th-new. These are mirrors of my
      local branch,<br>
      &gt;&gt; and I reserve the right to rebase them :). That said,
      please do try it<br>
      &gt;&gt; out!<br>
      &gt;&gt;<br>
      &gt;&gt; Geoff</span><br>
    <br>
  </body>
</html>