Re: weird behaviour of context resolution with FlexibleContexts and TypeFamilies

2011-02-26 Thread Ganesh Sittampalam
Hi Dimitrios, Done: http://hackage.haskell.org/trac/ghc/ticket/4981 BTW although I said in my original email that this happened on GHC 6.12 as well as GHC 7, it looks like that's not the case for the cutdown example. I'm fairly sure that it happened with my original code; let me know if it's

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,

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)) =

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