#5248: Infer type context in a type signature
----------------------------------------+-----------------------------------
    Reporter:  gidyn                    |        Owner:                         
  
        Type:  feature request          |       Status:  new                    
  
    Priority:  normal                   |    Milestone:                         
  
   Component:  Compiler (Type checker)  |      Version:  7.0.3                  
  
    Keywords:                           |     Testcase:                         
  
   Blockedby:                           |   Difficulty:                         
  
          Os:  Unknown/Multiple         |     Blocking:                         
  
Architecture:  Unknown/Multiple         |      Failure:  GHC rejects valid 
program
----------------------------------------+-----------------------------------

Comment(by gidyn):

 I'm not following; perhaps I'm thinking too much like an OO programmer.

 To use a simpler example,

 {{{
 data Pair a = Eq a => Pair {x::a, y::a}

 equal :: Eq a => Pair a -> a -> Bool
 equal pair z = (x pair) == (y pair) && (x pair) == z
 }}}

 Whenever we see Pair a, we know that Eq a. Nevertheless, the type
 signature for equal must be augmented with a redundant Eq a => Pair a. If
 I have two dozen functions relying on the Eq-ness of Pair a, that's two
 dozen redundant type contexts.

 Eq a => Pair should not need to be inferred from the definition of equal,
 as it is stated explicitly in the definition of Pair.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5248#comment:6>
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