RE: [Template-haskell] How to get list of instances of a given class?
| Is it possible to publish a list of what is possible to | access/introspect, and what is not possible? In 6.2.2? In 6.4.1? 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. But I'm entirely willing to answer qns. | Just for the future: from the original Template Haskell paper [2], I | got the impression that the ultimate goal was to be able to access the | whole tree of objects internally known to the compiler at the moment | when the TH constructs are involved, wasn't it? However I understand | that the priority is low. 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. Many of the things that need doing do not require new design work -- they just involve filling out the interface -- and hence could be done by someone other than me! A particularly easy thing to do is to fill out the Wiki Simon
Simon,
On 12/16/05, Simon Peyton-Jones
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
"Simon Peyton-Jones"
A particularly easy thing to do is to fill out the Wiki
Speaking of which, Johannes Ahlmann is working on a Template Haskell Tutorial: http://www.haskell.org/hawiki/TemplateHaskellTutorial -- Shae Matijs Erisson - http://www.ScannedInAvian.com/ - Sockmonster once said: You could switch out the unicycles for badgers, and the game would be the same.
participants (3)
-
Dimitry Golubovsky -
Shae Matijs Erisson -
Simon Peyton-Jones