#7123: Dictionary method should be applicable even in existential context
------------------------------+---------------------------------------------
 Reporter:  heisenbug         |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------

Comment(by heisenbug):

 @parcs: of course, if you just look at `(Int, Int)` and the `Foo` class
 definition, injectivity is necessary to resolve to the right instance. My
 point is that the instance has already been resolved when the `q` value
 has been created, and at the point of the pattern match only the `baz`
 method needs to be extracted from the dictionary saved inside `q` and
 applied. Of course this means that the typechecker does not stare on the
 type of `(Int, Int)` but at the original type `Bar a` and uses that as the
 argument of the call to `baz`.
 I am pretty sure that somebody will stand up and declare "this is not how
 type class method resolution works" but I am interested to hear the "why"
 :-)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7123#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to