Hi, all! I guess this belongs to haskell-cafe or glasgow-haskell-users, but I've already been there and got no replies. Thanks in advance for anyone taking the time to read on.
Given two type classes A t and B t, I'd like the typechecker to derive different A t instances depending exactly on whether t is an instance of B. In other words, is it possible to define a class (actually a type-level function) IsB t f such that: IsB t HTrue <=> instance (B t) exists IsB t HFalse <=> otherwise? If not, is this wish intrisically pointless? After experimenting a bit with multiparameter classes, overlapping instances and suchlike, it looks like Haskell is being purposedly designed not to support this. Yes, I believe that would require the typechecker to take a whole new theorem-proving (undecidable?) stance :o) On the other hand, any interesting type-level programming seems to require undecidable+overlapping instances, so we are usually working on undecidable grounds... Sorry if this is an overdebated matter (is it?), but searching through the endless haskell archives is not trivial. Thanks in advance for any pointers or thoughts on the matter. Cheers, Jorge. _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
