#1050: Using an inferred type as a type signature fails
----------------------------------------+-----------------------------------
    Reporter:  simonpj                  |       Owner:         
        Type:  bug                      |      Status:  new    
    Priority:  low                      |   Milestone:  _|_    
   Component:  Compiler (Type checker)  |     Version:  6.6    
    Severity:  minor                    |    Keywords:         
  Difficulty:  Unknown                  |    Testcase:         
Architecture:  Unknown                  |          Os:  Unknown
----------------------------------------+-----------------------------------
See the thread starting here
 http://www.haskell.org/pipermail/glasgow-haskell-users/2006-
 December/011714.html.
 Here's a short example:
 {{{
 class C a b where
    op :: a -> a

 -- f :: C a b => a -> a
 f x = op x
 }}}
 It doesn't get much simpler than that!  With the type sig, GHC can't see
 that the `(C a b)` provided can satisfy the `(C a b1)` which arises from
 the call to op.   However, without the constraint, GHC simply abstracts
 over the constrains arising in the RHS, namely `(C a b1)`, and hence
 infers the type
 {{{
         f :: C a b1 => a -> a
 }}}
 It is extremely undesirable that the inferred type does not work as a type
 signature, but I don't see how to fix it easily.  It doesn't affect many
 programs, I think; hence low priority

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