#7862: Could not deduce (A) from the context (A, ...)
----------------------------------------+-----------------------------------
    Reporter:  alang9                   |       Owner:                          
 
        Type:  bug                      |      Status:  new                     
 
    Priority:  normal                   |   Milestone:                          
 
   Component:  Compiler (Type checker)  |     Version:  7.6.2                   
 
    Keywords:                           |          Os:  Linux                   
 
Architecture:  x86_64 (amd64)           |     Failure:  GHC rejects valid 
program
  Difficulty:  Unknown                  |    Testcase:                          
 
   Blockedby:                           |    Blocking:                          
 
     Related:                           |  
----------------------------------------+-----------------------------------

Comment(by simonpj):

 OK, so now we get (from the original program)
 {{{
 T7862a.hs:17:24:
     Overlapping instances for Num (Tower s0 a)
       arising from a use of ‛<+>’
     Matching givens (or their superclasses):
       (Num (Tower s a))
         bound by the instance declaration at T7862a.hs:14:10-36
     Matching instances:
       instance Num a => Num (Tower s a) -- Defined at T7862a.hs:19:10
     (The choice depends on the instantiation of ‛a, s0’)
     In the expression: (Tower as) <+> (Tower as)
 }}}
 which is better but not good.  For two reasons:
  * The "matching given" comes from one of the "silent supperclass"
 parameters, which is confusing to the user.
  * The whole thing is really due to the ambiguity of `s0`, and that's not
 even reported.

 The reason we are careful about overlap between givens and instances is
 desribed in `Note [Instance and Given overlap]` in `TcInteract`.

 I'm not sure what to do here. I'm expecting it's not a show-stopper for
 you: just add a type signature to resolve the ambiguity.

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

_______________________________________________
ghc-tickets mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-tickets

Reply via email to