Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5655 closed bug (fixed)

Oddity with ConstraintKinds and TypeFamilies

Reported by: illissius Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHC rejects valid program Difficulty:
Test Case: typecheck/should_compile/T5655 Blocked By:
Blocking: Related Tickets:

Description

See the attached program (not sure how to reduce it further - I don't know whether the relevant interaction is really with TypeFamilies, Rank2Types, or what).

When compiled with -DWORKAROUND, it compiles, when without, it doesn't. The difference:

#ifndef WORKAROUND
    ap :: (forall a. C e a => a -> r) -> e -> r
#else
    ap :: c ~ C e => (forall a. c a => a -> r) -> e -> r
#endif

(Where 'C e' is an associated type of 'e' of kind * -> Constraint.)

I sort of assumed that 'Some Type' and 'a ~ Some Type => a' would always be equivalent, but maybe I'm wrong. Feel free to mark as invalid if I am.

Attachments (1)

demo.hs (630 bytes) - added by illissius 2 years ago.
test case

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by illissius

test case

comment:1 Changed 2 years ago by illissius

Oh, also:

$ git log --max-count=1
commit be879ba686f96375c6e3d65b97ed0508ddbfc9a1
Author: Max Bolingbroke <batterseapower@hotmail.com>
Date:   Sat Nov 19 11:27:38 2011 +0000

    Add branch command to sync-all

comment:2 Changed 2 years ago by simonpj@…

commit 922176f6c99dceb910b6d1a2c98ec0edbe4a39e6

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Wed Nov 23 15:14:56 2011 +0000

    Use mkAppTys, not foldl AppTy, which was utterly wrong
    
    This bug caused Trac #5655

 compiler/typecheck/TcCanonical.lhs |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

comment:3 Changed 2 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to typecheck/should_compile/T5655

It was a stupid bug, now fixed. Thanks for reporting it so accurately.

Simon

comment:4 Changed 2 years ago by illissius

Thanks for fixing it so quickly.

Note: See TracTickets for help on using tickets.