Skip to content

Oddity with ConstraintKinds and TypeFamilies

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.

Trac metadata
Trac field Value
Version 7.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information