COMPLETE pragmas seem to be ignored when using view patterns
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE PatternSynonyms #-}
pattern I :: Int -> Int
pattern I x <- (id -> x)
{-# COMPLETE I #-}
foo :: Int -> Int
foo (I x) = x + 3
bar :: Int -> Int
bar (id->I x) = x + 3
main :: IO ()
main = return ()
Raises a warning for bar
:
Bug.hs:12:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for 'bar': Patterns not matched: _
|
12 | bar (id->I x) = x + 3
| ^^^^^^^^^^^^^^^^^^^^^^^
but not for foo
.