Precedence out of range [GHC-25078]
When defining custom infix operators and assigning them an operator precedence with infixl
or infixr
, the precedence must be 1 <= x <= 9
.
Examples
Invalid operator precedence
An operator’s precedence must be 1 <= x <= 9
.
Error Message
InvalidPrecedence.hs:6:8: error: [ghc-25078]
Precedence out of range: 1000
|
6 | infixl 1000 ⊚‿⊚
| ^^^^
InvalidPrecedence.hs
Before
module InvalidPrecedence where
(⊚‿⊚) :: Int -> Int -> Int
(⊚‿⊚) = (+)
infixl 1000 ⊚‿⊚
After
module InvalidPrecedence where
(⊚‿⊚) :: Int -> Int -> Int
(⊚‿⊚) = (+)
infixl 9 ⊚‿⊚