Skip to content

Duplicate warnings for pattern guards and relevant features (e.g. View Patterns)

There are some cases where the new exhaustiveness checker emits duplicate warnings. E.g. for f:

f :: Bool -> Bool -> ()
f (not -> True) (not -> False) = ()

we get:

DuplicateWarn.hs:6:1: warning:
    Pattern match(es) are non-exhaustive
    In an equation for ‘f’:
        Patterns not matched:
            _ _     -- represents (not -> False) _
            _ _     -- represents (not -> True)  (not -> True)

As indicated in the comments, the two warnings represent different missing cases, but since we do not print the additional information, they look alike. It would be better to either:

  • Give additional information to the user to distinguish between the two or
  • Print a single warning (_ _)

I cannot think of a nice solution to this yet but I will keep thinking about it.

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