Skip to content

GHC.Types.Any leaks in -Wincomplete-patterns warning

Summary

{-# OPTIONS_GHC -Wincomplete-patterns #-}

module Bug where

foo :: Either a Char
foo = Right 'x'

bar :: String
bar = case foo of
  Right c -> [c]

we get a warning message:

Bug.hs:9:7: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In a case alternative:
        Patterns of type ‘Either GHC.Types.Any Char’ not matched: Left _
  |
9 | bar = case foo of
  |       ^^^^^^^^^^^...

which leaks details about GHC.Types.Any.

Environment

  • GHC version used: 9.2.4, 9.4.2

    The bug does not occur in GHC 8.10.7 or GHC 9.0.2. Those versions do not have a Patterns of type clause in the warning.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information