RE: weird behaviour of context resolution with FlexibleContexts and TypeFamilies

2011-02-25 Thread Dimitrios Vytiniotis
Hi Ganesh, you are right Simon's answer is not correct. The cause of your problem is I believe quite involved -- I think I know what's going on (Simon: it seems to be an overlap problem indeed but between a different instance and given arising from a superclass when trying to solve a 'silent pa

Re: weird behaviour of context resolution with FlexibleContexts and TypeFamilies

2011-02-25 Thread Ganesh Sittampalam
Hi Simon, You talk about the timing of application of the instance declaration instancePatchInspect (PrimOf p)) => Conflict p but the constraint is actually defined in the class declaration, and I don't have any instance declarations for Conflict p itself. classPatchInspect (PrimOf p)) => Co

RE: weird behaviour of context resolution with FlexibleContexts and TypeFamilies

2011-02-25 Thread Simon Peyton-Jones
You are doing something very delicate here, akin to overlapping instances. You have an instance instance PatchInspect (PrimOf p)) => Conflict p and a function clever :: (Conflict (OnPrim p), ..) => ... So if a constraint (Conflict blah) arises in the RHS of clever,