[Haskell] detecting existing instances

Taral taralx at gmail.com
Wed Jan 9 14:22:13 EST 2008

On 1/9/08, Jorge Marques Pelizzoni <jpeliz at icmc.usp.br> wrote:
> 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.

I think this would require some kind of whole-program analysis. While
Haskell provides assertions that t is an instance of B (B t), it does
*not* provide assertions that t is not an instance of B. This is
because an instance of B can be declared by other modules at a later
point (e.g. by someone who imports your module).

Taral <taralx at gmail.com>
"Please let me know if there's any further trouble I can give you."
    -- Unknown

More information about the Haskell mailing list