[Haskell-cafe] reifying is-a

Jorge Marques Pelizzoni jpeliz at icmc.usp.br
Sun Jan 6 23:48:59 EST 2008



Hi, all! I guess what I am about to ask is currently impossible, but as
you haskellers always manage to amaze me here it goes. Given two type
classes A t and B t, I'd like to derive (two) different A t instances
depending exactly on whether t is an instance of B. In other words, is it
possible to define a type-level function/class IsB t f such that:

IsB t HTrue <=> (B t) exists
IsB t HFalse <=> otherwise?

If not, is this wish intrisically pointless?

Thanks in advance. Cheers,

Jorge M. Pelizzoni
ICMC - Universidade de São Paulo



More information about the Haskell-Cafe mailing list