Description
See repro section for precise description of the symptoms. I'm not completely sure what the problem is, but it looks like the apartness check happens separately for each parameter of the instance, so that the instance may be considered partially overlapping if each parameter cannot be shown to be "apart" when considered in isolation, even if there is no possible substitution that would match all parameters together.
To Reproduce
newtype N a = N a
class C a b
instance C (N a) (N a)
else instance C a (N a)
x :: forall a. C a (N a) => Unit
x = unit
y :: Unit
y = x
The last line yields an error:
No type class instance was found for C t0 (N t0)
The following instance partially overlaps ...
instance C (N a) (N a)
How can C (N a) (N a) possibly overlap C t0 (N t0)? That would require t0 ~ N t0.
Expected behavior
The second instance should be chosen, allowing the program to compile.
PureScript version
0.15.2
Reactions are currently unavailable
Description
See repro section for precise description of the symptoms. I'm not completely sure what the problem is, but it looks like the apartness check happens separately for each parameter of the instance, so that the instance may be considered partially overlapping if each parameter cannot be shown to be "apart" when considered in isolation, even if there is no possible substitution that would match all parameters together.
To Reproduce
The last line yields an error:
No type class instance was found for C t0 (N t0) The following instance partially overlaps ... instance C (N a) (N a)How can C (N a) (N a) possibly overlap C t0 (N t0)? That would require t0 ~ N t0.
Expected behavior
The second instance should be chosen, allowing the program to compile.
PureScript version
0.15.2