Re: example of derive using Template Haskell?

Sean Seefried <[email protected]> Fri, 14 Jan 2005 13:30:10 +1100
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
On 14/01/2005, at 7:22 AM, S. Alexander Jacobson wrote:

> This is really great.  Do you have an example of use of each of these 
> functions?
>
> e.g. do I do:
>
>   $(derive [Int,String,MyTime])
> or
>
>   $(derive ["Int","String","MyTime"])

Oh dear, I've just realised a problem. This code only works with GHC 
6.3. Template Haskell has changed a lot since GHC 6.2.

What you should type is

$(derive [ ''Int, ''String, ''MyTime ])

The '' syntax means "get the name of this type". There is also a single 
quote syntax ' which means "get the name of this variable". This is new 
syntax introduced with Template Haskell.

Sean