#1549: ghc derives different type signature for equal functions with overlapping
instances
------------------------------+---------------------------------------------
    Reporter:  int-e          |        Owner:          
        Type:  proposal       |       Status:  reopened
    Priority:  low            |    Milestone:          
   Component:  Documentation  |      Version:  6.7     
    Severity:  trivial        |   Resolution:          
    Keywords:                 |   Difficulty:  Unknown 
          Os:  Linux          |     Testcase:          
Architecture:  x86            |  
------------------------------+---------------------------------------------
Comment (by simonpj):

 Looking at it again, I this would be better to add this after "without
 complaining about
 the problem of subsequent instantiations":

 Notice that we gave a type signature to `f` so GHC had to
 ''check'' that `f` has the specified type.
 Suppose instead we do not give a type signature, asking GHC to ''infer''
 it instead.  In this case, GHC will refrain from
 simplifying the constraint `C Int [Int]` (for the same reason
 as before) but, rather than rejecting the program, it will infer the type
 {{{
   f :: C Int b => [b] -> [b]
 }}}
 That postpones the question of which instance to pick to the
 call site for `f`
 by which time more is known about the type `b`

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1549>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to