(~) should be infix 0
Summary
(~)
has no fixity declaration, so is treated as having maximal fixity.
This breaks equality constraints where one side uses an infix operator (i.e. of
the form (x+y ~ z)
), requiring seemingly unnecessary parentheses around
x+y
.
Steps to reproduce
GHCi 8.6.5:
Prelude> import GHC.TypeNats
Prelude GHC.TypeNats> :set -XDataKinds -XTypeOperators
Prelude GHC.TypeNats> :k (2 ~ 3 + 5)
<interactive>:1:2: error:
• Expected kind ‘Nat’, but ‘2 ~ 3’ has kind ‘Constraint’
• In the first argument of ‘(+)’, namely ‘2 ~ 3’
In the type ‘(2 ~ 3 + 5)’
Expected behavior
(2 ~ 3 + 5) :: Constraint
Environment
- GHC version used: 8.6.5