Binding type variables is not allowed in pattern bindings [GHC-48361]
Patterns can bind constructor arguments to variables, but they are not able to bind type arguments to type variables.
Examples
Binding type variables is not allowed in pattern bindings
Error Message
Error.hs:4:1: error: [GHC-48361]
• Binding type variables is not allowed in pattern bindings
• In the pattern: Just @a x
In a pattern binding: Just @a x = Just (5 :: Integer)
|
4 | Just @a x = Just (5 :: Integer)
| ^^^^^^^^^
Error.hs
Before
module Main where
x :: Integer
Just @a x = Just (5 :: Integer)
After
module Main where
x :: Integer
Just x = Just (5 :: Integer)