Opened 7 years ago

Closed 4 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 Difficulty: Unknown
Test Case: typecheck/should_compile/T1634 Blocked By:
Blocking: Related Tickets:

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 4 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 7 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 6 years ago by simonpj

  • Milestone set to 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 5 years ago by igloo

  • Milestone changed from 6.10 branch to 6.12 branch

comment:4 Changed 5 years ago by guest

comment:5 Changed 4 years ago by igloo

  • Milestone changed from 6.12 branch to 6.12.3

comment:6 Changed 4 years ago by igloo

  • Milestone changed from 6.12.3 to 6.14.1
  • Priority changed from normal to low

Changed 4 years ago by reinerp

comment:7 Changed 4 years ago by reinerp

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to typecheck/should_compile/T1634
  • Type of failure set to None/Unknown

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

comment:8 Changed 4 years ago by reinerp

  • Resolution fixed deleted
  • Status changed from closed to new

comment:9 Changed 4 years ago by reinerp

  • Status changed from new to patch

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 4 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 4 years ago by igloo

  • Resolution set to fixed
  • Status changed from patch to closed

Applied to HEAD and 7.0, thanks!

Note: See TracTickets for help on using tickets.