GHC doesn't use fixity in type instances
If I say
data a * b infixl 7 * type family a + b infixl 6 + type instance Int * Bool + Double = Float
* is not the issue here)
• Illegal family instance for ‘*’ (* is not an indexed type family) • In the type instance declaration for ‘*’
But that's wrong. The
* should bind tighter than the
+, meaning this is an instance for
*. This also fails for closed type families:
data a * b infixl 7 * type family a + b where Int * Bool + Double = Float infixl 6 +
Interestingly, a class instance works here.
This did not bite me "in the wild", but came up while reading the GHC source code. Still, it is a real bug.