Opened 10 years ago

Closed 7 years ago

#1634 closed bug (fixed)

Type signature normalization

Reported by: kfrdbs@… Owned by: igloo
Priority: low Milestone: 7.0.1
Component: Compiler (Type checker) Version: 6.6.1
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: None/Unknown Test Case: typecheck/should_compile/T1634
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

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

Attachments (1)

1634-test.dpatch (88.7 KB) - added by reinerp 7 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 10 years ago by simonpj

Description: modified (diff)

Currently, the two types are not the same. They used to be the same; see Section 4.6 of 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

comment:2 Changed 10 years ago by simonpj

Milestone: 6.10 branch

I'm going to milestone this for 6.10 for now, just to make sure we look at it again. I'd certainly prefer that the type system was insensitive to eta expansion, but it's a bit of a delicate question.

Simon

comment:3 Changed 9 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:4 Changed 9 years ago by guest

comment:5 Changed 8 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:6 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

Changed 7 years ago by reinerp

Attachment: 1634-test.dpatch added

comment:7 Changed 7 years ago by reinerp

Resolution: fixed
Status: newclosed
Test Case: typecheck/should_compile/T1634
Type of failure: None/Unknown

Works in 7.0-rc1. I've attached a patch which adds this to the testsuite.

comment:8 Changed 7 years ago by reinerp

Resolution: fixed
Status: closednew

comment:9 Changed 7 years ago by reinerp

Status: newpatch

I've set this ticket's status to 'patch', to get the testsuite patch reviewed.

I'm not sure of the protocol here. How should I signal that this bug has been fixed, but still has a patch attached?

comment:10 Changed 7 years ago by simonpj

Owner: set to igloo

Setting it to 'patch' is good.

Ian: would you like to apply please?

Simon

comment:11 Changed 7 years ago by igloo

Resolution: fixed
Status: patchclosed

Applied to HEAD and 7.0, thanks!

Note: See TracTickets for help on using tickets.