Skip to content

Type family with higher-rank result is too accepting

GHC accepts this garbage:

type family F2 :: forall k. k -> Type
data SBool :: Bool -> Type
data Nat
data SNat :: Nat -> Type
type instance F2 = SBool
type instance F2 = SNat

The family F2 should have an arity of 0, meaning that only one instance is possible -- and the RHS of that instance must have kind forall k. k -> Type. In other words, even accepting only one of the instances above is hogwash.

This is from ticket:11719#comment:161416, but you don't have to read that to understand this.

Trac metadata
Trac field Value
Version 8.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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