[Haskell] Template id function

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Jul 13 15:20:51 EDT 2005


On Wed, Jul 13, 2005 at 08:50:21PM +0200, Mads Lindstr?m wrote:
> I am trying to learn Meta Haskell. One thing I want to do is create an
> identity function. It should get a type constructor as input and return
> the same type constructor as output. It should be possible to do:
> 
>   $(idDecl data Foo = Foo Int)
> 
> and it should "return":
> 
>   data Foo = Foo Int
> 
> Is this possible? if yes, how does one do it?

You mean:

    $(id [d| data Foo = Foo Int |])

?

Best regards
Tomasz


More information about the Haskell mailing list