[Template-haskell] How to get list of instances of a given class?

Dimitry Golubovsky golubovsky at gmail.com
Fri Dec 16 10:20:38 EST 2005


Simon,

On 12/16/05, Simon Peyton-Jones <simonpj at microsoft.com> wrote:

> It's hard for me to do that.  Except to say: look at the Info type
>
> http://www.haskell.org/ghc/docs/latest/html/libraries/template-haskell/L
> anguage-Haskell-TH-Syntax.html#t%3AInfo
>
> which tells you what reify returns.

OK, I was looking at "Dec" which has InstanceD, but "Info" does not
have InstanceI, now I see.

BTW is "Dec" for "Declaration"? All I would need is the fact that a
particular instance was declared, nothing else.

> The priority is low because few people ask, and because few people
> volunteer.  It's a shame because it's a bit chicken-and-egg-ish.  If TH
> was more complete, more people might use it.

Well, I felt some necessity when trying to implement the X11 protocol
client side in Haskell: there are many C structures for which peek and
poke methods could be easily generated via TH. But as I wrote in this
particular case I have a workaround, albeit tool-specific.

--
Dimitry Golubovsky

Anywhere on the Web


More information about the template-haskell mailing list