[Template-haskell] Template Haskell and Hydra

Simon Peyton-Jones simonpj@microsoft.com
Tue, 21 Jan 2003 08:30:55 -0000


| Thanks for the suggestion - that certainly would be fine as
| an interim solution, and I'll give it a try as soon as
| the declaration brackets are implemented.  My impression is
| that they aren't there yet?

No, declaration brackets are there already!  Remember, though, that you
can only splice in a separate module.  So in:

| > d1 =3D [d| f1 :: Clocked a =3D> a -> a -> (a,a)
| >           f1 a b =3D (x, z)
| >             where (x,y) =3D (f2 a y, f3 b x)
| >                    z =3D f4 a (f5 x y) z
| >       |]
| >
| > f1 =3D splice d1

This isn't quite right.  For a start, the splice should look like

     $d1

(No "f1 =3D"; that's in the code already.)

Secondly the splice has to be in a separate module (sorry).  So define
d1 in one module, and splice it in another.  (Reason: you are running
code.  This is an impl restriction; could be lifted with more work.)

let us know how you get on.

Simon