runtime reflection for classes

2006-02-09 Thread Johannes Waldmann
With Data.Generics, we can get an object's type, constructor and fields. I think there should be way to get the object's class(es) and methods. E. g. I want to find out whether the object's type implements Show, and if so, call the show method (and if not, call some replacement). See

Re: runtime reflection for classes

2006-02-09 Thread Bulat Ziganshin
Hello Johannes, Thursday, February 09, 2006, 1:43:38 PM, you wrote: JW With Data.Generics, we can get an object's type, constructor and fields. really, SYB way to metaprogramming is just to encode information about type in the datastructure. you can do somethiong in this fashion just by

Re: runtime reflection for classes

2006-02-09 Thread Johannes Waldmann
Bulat Ziganshin wrote: again TH can be used and you will be limited only by the volume of information, available for TH code. Is information such as instance C t1 t2 .. available for such code? I guess not since this would require information from the compiler (type checker), but TH

Re: runtime reflection for classes

2006-02-09 Thread Donald Bruce Stewart
waldmann: With Data.Generics, we can get an object's type, constructor and fields. I think there should be way to get the object's class(es) and methods. E. g. I want to find out whether the object's type implements Show, and if so, call the show method (and if not, call some replacement).

Re: exported pattern matching

2006-02-09 Thread S.J.Thompson
Jim - it's worth looking at the proposal for views, proposed by Warren Burton et al, accessible from http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/Views regards Simon T On Thu, 9 Feb 2006, Jim Apple wrote: Sometimes I'd like to use a smart constructor but have pattern

Re: exported pattern matching

2006-02-09 Thread Philippa Cowderoy
On Thu, 9 Feb 2006, S.J.Thompson wrote: Jim - it's worth looking at the proposal for views, proposed by Warren Burton et al, accessible from http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/Views Myself I'm of the view transformational patterns (as described in

Re: exported pattern matching

2006-02-09 Thread Ben Rudiak-Gould
Philippa Cowderoy wrote: Myself I'm of the view transformational patterns (as described in http://citeseer.ist.psu.edu/299277.html) are more interesting - I can't help wondering why they were never implemented? Maybe because of tricky semantics. I'm not quite sure what case x of

Re[2]: runtime reflection for classes

2006-02-09 Thread Bulat Ziganshin
Hello Johannes, Thursday, February 09, 2006, 2:43:49 PM, you wrote: again TH can be used and you will be limited only by the volume of information, available for TH code. JW Is information such as instance C t1 t2 .. available for such code? JW I guess not since this would require