Skip to content

Pattern match exhaustiveness check only suggets constructors from the vanilla COMPLETE set

Due to how getUnmatchedConstructor is implemented, we only suggest unmatched constructors from the vanilla COMPLETE set. Example:

{-# LANGUAGE PatternSynonyms #-}

module Lib where

data T = A | B | C

pattern P = B
{-# COMPLETE A, P #-}

f :: T -> ()
f A = ()

Generated warning:

    Pattern match(es) are non-exhaustive
    In an equation for ‘f’:
        Patterns not matched:
            B
            C
   |
11 | f A = ()
   | ^^^^^^^^

But P would be enough here! It's hard to say what the user wants here. We could just print all different residual COMPLETE sets, I guess.

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