
14 Feb
2011
14 Feb
'11
11:48 p.m.
On 14 February 2011 21:43, Patrick Bahr
Am I doing something wrong or is it not possible for GHC to dispatch a rule according to type class constraints?
As you have discovered this is not possible. You can write the rule for as many *particular* types as you like, but you can't write it in a way that abstracts over the exact type class instance you mean. This is a well known and somewhat tiresome issue. I think the reason that this is not implemented is because it would require the rule matcher to call back into the type checking machinery to do instance lookup. Cheers, Max