Skip to content

Inconsistent precedence of ~

The following compiles as expected:

{-# LANGUAGE TypeFamilies #-}
type family Foo a b

f :: (Foo a b ~ Int) => a -> b -> b
f = error ""

but this fails:

{-# LANGUAGE TypeFamilies #-}
type family a \\ b

f :: (a \\ b ~ Int) => a -> b -> b
f = error ""

with the error

"The second argument of (\\) should have kind *, but b ~ Int has kind Constraint."

Thus the first example is being parsed as (Foo a b) ~ Int, while the second is parsed as a \\ (b ~ Int). I believe the second example should compile, i.e. (\\) and Foo should have the same precedence, both of which are higher than (~).

Trac metadata
Trac field Value
Version 7.8.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information