#1634: Type signature normalization
----------------------------------------+-----------------------------------
    Reporter:  [EMAIL PROTECTED]         |        Owner:         
        Type:  bug                      |       Status:  new    
    Priority:  normal                   |    Milestone:         
   Component:  Compiler (Type checker)  |      Version:  6.6.1  
    Severity:  normal                   |   Resolution:         
    Keywords:                           |   Difficulty:  Unknown
          Os:  Linux                    |     Testcase:         
Architecture:  x86                      |  
----------------------------------------+-----------------------------------
Old description:

> {{{
> t1 :: a->(forall b. b->(a,b)) -- isn't this the same as forall a b.
> a->b->(a,b)
> t1 = (,)
> }}}
> causes
> {{{
>     Inferred type is less polymorphic than expected
>       Quantified type variable `b' escapes
>     Probable cause: `(,)' is applied to too few arguments
>     In the expression: (,)
>     In the definition of `t1': t1 = (,)
> }}}
>
> The problem goes away without the explicit signature.
> -- Kefer

New description:

 {{{
 t1 :: a->(forall b. b->(a,b))
 -- isn't this the same as forall a b. a->b->(a,b)
 t1 = (,)
 }}}
 causes
 {{{
     Inferred type is less polymorphic than expected
       Quantified type variable `b' escapes
     Probable cause: `(,)' is applied to too few arguments
     In the expression: (,)
     In the definition of `t1': t1 = (,)
 }}}

 The problem goes away without the explicit signature.
 -- Kefer

Comment (by simonpj):

 Currently, the two types are not the same.  They '''used''' to be the
 same; see Section 4.6 of [http://research.microsoft.com/~simonpj/papers
 /higher-rank/index.htm Practical type inference for higher rank types];
 but adding inference for impredicative types meant we had to remove deep
 skolemisation.

 See also #1123.

 I'm interested in gathering evidence for whether this change really
 matters to people. Did this arise in a real program?

 Incidentally, another fix is just to eta-expand:
 {{{
 t1 :: a->(forall b. b->(a,b))
 t1 x y = (,) x y
 }}}

 Simon

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