<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;">> Fantastic! I will definitely
be trying it out early next week.<br>
><br>
> Are there any special instructions regarding how to compile
this<br>
> branch? I will work on adding test cases, which would be
translations<br>
> of larger metaocaml programs.<br>
><br>
> Jacques<br>
><br>
> On 13-05-16 11:21 AM, Geoffrey Mainland wrote:<br>
>> I have pushed a new branch, th-new, that partially
implements the<br>
>> proposal outlined in Simon PJ's "New directions for
Template Haskell"<br>
>> post at:<br>
>><br>
>>
<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>
>><br>
>> The main missing features are top-level pattern splices
and local<br>
>> declaration splices.<br>
>><br>
>> Typed expression quotations and typed expression splices
*are*<br>
>> implemented. Syntax is as in Simon's original proposal:
[|| ||] for<br>
>> typed expression brackets and $$(...) for typed
expression splices. One<br>
>> can now write:<br>
>><br>
>> power :: Int -> TExp (Int -> Int)<br>
>> power n = [|| \x -> $$(go n [|| x ||]) ||]<br>
>> where<br>
>> go :: Int -> TExp Int -> TExp Int<br>
>> go 0 x = [|| 1 ||]<br>
>> go n x = [|| $$x * $$(go (n-1) x) ||]<br>
>><br>
>> In fact, one can even write:<br>
>><br>
>> power :: Num a => Int -> TExp (a -> a)<br>
>> power n = [|| \x -> $$(go n [|| x ||]) ||]<br>
>> where<br>
>> go :: Num a => Int -> TExp a -> TExp a<br>
>> go 0 x = [|| 1 ||]<br>
>> go n x = [|| $$x * $$(go (n-1) x) ||]<br>
>><br>
>> Writing the following<br>
>><br>
>> f :: TExp Char -> TExp Integer<br>
>> f x = [|| $$x * 3 ||]<br>
>><br>
>> gives the error<br>
>><br>
>> Main.hs:28:7:<br>
>> Couldn't match type ‛Char’ with ‛Integer’<br>
>> Expected type: TExp Integer<br>
>> Actual type: TExp Char<br>
>> In the Template Haskell quotation [|| $$x * 3 ||]<br>
>> In the expression: [|| $$x * 3 ||]<br>
>> In an equation for ‛f’: f x = [|| $$x * 3 ||]<br>
>><br>
>> The th-new branch of ghc has accompanying branches for
template-haskell<br>
>> and testsuite, both named th-new. These are mirrors of my
local branch,<br>
>> and I reserve the right to rebase them :). That said,
please do try it<br>
>> out!<br>
>><br>
>> Geoff</span><br>
<br>
</body>
</html>