Opened 6 years ago

Closed 6 years ago

Last modified 6 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 Test Case: typecheck/should_compile/T5655
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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:

    ap :: (forall a. C e a => a -> r) -> e -> r
    ap :: c ~ C e => (forall a. c a => a -> r) -> e -> r

(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 6 years ago.
test case

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by illissius

Attachment: demo.hs added

test case

comment:1 Changed 6 years ago by illissius

Oh, also:

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

    Add branch command to sync-all

comment:2 Changed 6 years ago by simonpj@…

commit 922176f6c99dceb910b6d1a2c98ec0edbe4a39e6

Author: Simon Peyton Jones <>
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 6 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: typecheck/should_compile/T5655

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


comment:4 Changed 6 years ago by illissius

Thanks for fixing it so quickly.

Note: See TracTickets for help on using tickets.