TypeOperators/Rank2Types clash
Consider the following piece of code:
{-# LANGUAGE GADTs #-}
data Any s where
Any :: s ix -> ix -> Any s
data AnyR s r where
AnyR :: s ix -> r ix -> AnyR s r
unR :: (forall ix. r ix -> ix) -> AnyR s r -> Any s
unR f (AnyR ix rix) = Any ix (f rix)
GHC reports:
Illegal operator `.' in type `forall ix . (r ix -> ix)'
Perhaps you intended to use -XRankNTypes or similar flag
to enable explicit-forall syntax: forall <tvs>. <type>
Enabling TypeOperators causes the error to change to:
Occurs check: cannot construct the infinite type: ix = r ix
In the pattern: AnyR ix rix
In the definition of `unR': unR f (AnyR ix rix) = Any ix (f rix)
Which is very confusing, as the solution (still) is to turn on Rank2Types.
Could it be made so that the error message stays the same when TypeOperators is turned on?
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |