You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that in some cases the compiler may choose different instances from an instance chain in different places. Since ValueOf coercions depend on the uniqueness of instances, this can lead to unsoundness. Here's an example:
The problematic instance resolution seems to happen in coerceFromF, where the second instance is always chosen despite the type constructor not being known to be different from Array.
I don't know enough about instance chains to tell if this is the expected behavior; it's not intuitive to me, but maybe that's how instance chains work. So either this is a bug in the compiler, or the ValueOf trick is not safe to use in PureScript. Which would be sad, because this library is quite powerful :)
The text was updated successfully, but these errors were encountered:
The problematic instance resolution seems to happen in coerceFromF, where the second instance is always chosen despite the type constructor not being known to be different from Array.
It seems that in some cases the compiler may choose different instances from an instance chain in different places. Since
ValueOf
coercions depend on the uniqueness of instances, this can lead to unsoundness. Here's an example:This compiles and prints
undefined
.The problematic instance resolution seems to happen in
coerceFromF
, where the second instance is always chosen despite the type constructor not being known to be different fromArray
.I don't know enough about instance chains to tell if this is the expected behavior; it's not intuitive to me, but maybe that's how instance chains work. So either this is a bug in the compiler, or the ValueOf trick is not safe to use in PureScript. Which would be sad, because this library is quite powerful :)
The text was updated successfully, but these errors were encountered: