Skip to content

Empty case does not detect kinds

{-# language TypeInType, EmptyCase #-}
module Silly where
import Data.Kind

f :: Type -> Int
f x = case x of

GHC warns

    Pattern match(es) are non-exhaustive
    In a case alternative: Patterns not matched: _ :: *

In fact, Type is only a type because of TypeInType. It has no actual values, so the empty case is exhaustive.

To be honest, I kind of wish GHC would give me a warning for doing something so silly as to even give a function an argument of type Type, but I imagine that might be hard.

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority low
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