[Template-haskell] instance declarations

François-Régis Sinot francois-regis.sinot@laposte.net
15 Apr 2003 03:19:22 +0200


Hi

Could anyone recall me the syntax for instance declarations ?
(eg what form should have the 2nd argument to Instance ?)

My best guess was something like:

genReg' :: Q [Dec]
genReg' = do dec1<-fun "out" [clause [pvar "x"] (normal [|foo|]) []]
	     ctx1<-ctxt []
	     clss<-tapp (tcon (TconName "Regular")) 
	                (tcon (TconName "Tree"))
	     return [Instance ctx1 clss [dec1]] 

intended to produce something like:

instance Regular Tree where
   out x = ...

But it gives a kind error on Tree:

Kind error: `Tree' is not applied to enough type arguments
When checking kinds in `Regular Tree'
In the instance declaration for `Regular Tree'

More generally, is there some kind of comprehensive up-to-date
documentation for this kind of questions ?

Thanks,
fr.