Qualified pattern names cause a parsing error in the Complete pragma
Summary
Qualified patterns used in a Complete
pragma cause a parse error.
Steps to reproduce
The following code encounters a parse error on the Complete
pragma.
{-# Language PatternSynonyms #-}
module Test
where
{-# Complete T, Prelude.False #-}
pattern T :: Bool
pattern T <- True where
T =
True
It produces the error:
/XXXXXXXX/Test.hs:5:17: error: parse error on input ‘Prelude.False’
|
5 | {-# Complete T, Prelude.False #-}
| ^^^^^^^^^^^^^
Expected behavior
I would expect this to have no error. I don't see a reason why a qualified pattern should be invalid. I also don't think that there is any reason you can't use qualified names in a pragma. I can see that I can use qualified functions and types in Specialize
pragmata just fine. Here;s an example of that:
module Test
where
{-# Specialize Prelude.elem :: Int #-}
Although I did notice that I can't use functions created with PatternSynonyms
in Specialize
pragmata at all. As an example
{-# Language PatternSynonyms #-}
module Test
where
{-# Specialize Id :: Int #-}
pattern Id :: a -> a
pattern Id x <- x where
Id =
id
produces the error
/XXXXXXXX/Test.hs:5:16: error: parse error on input ‘Id’
|
5 | {-# Specialize Id :: Int #-}
| ^^
This may be related.
Environment
- GHC version used: 8.10.4
Optional:
- Operating System: nixos