[Template-haskell] record accessor names

Rene de Visser rene_de_visser at hotmail.com
Mon Jul 25 10:52:06 EDT 2005


Hello,

Am I correct in thinking that with reify that I can not find the names of 
the read/write accessors rel1 and rel2 from the following?

data SmallDB = SmallDB { rel1 :: Set.Set String
                       , rel2 :: Set.Set Integer } deriving Show

I thought about quoting the above and splicing it in, but as you can't quote 
and splice back into the same module and due to type dependencies this could 
result in a mess of recursive modules.

I also though of generating the above from a union type.

i.e. using

data SmallDB = DBREL1 String | DBREL2 Integer

to generate the above. Then I would know the names of the accessors.

However I think it is not possible to have type dependencies based on data 
constuctors?
Actually, is this what GADT's allow one to do?
Does template haskell support GADT's`? i.e. with reify and syntax structure 
wise?

Rene.




More information about the template-haskell mailing list