Description
Role inference doesn't look under the ConstrainedType constructor, so some parameters may be incorrectly marked as phantom when they should be nominal or representational. For example:
module Main where
import Safe.Coerce (coerce)
class C
data T a = T (C => a)
-- This incorrectly compiles, demonstrating that T's role is inferred as phantom
oops :: forall a b. T a -> T b
oops = coerce
To Reproduce
While defining a data type, use a constrained type for one of the arguments of a data constructor, and allow the compiler to infer the roles for that type.
Expected behavior
The compiler takes into account any occurrences of the type's formal parameters within constrained types while inferring roles.
PureScript version
master
Description
Role inference doesn't look under the
ConstrainedTypeconstructor, so some parameters may be incorrectly marked asphantomwhen they should benominalorrepresentational. For example:To Reproduce
While defining a data type, use a constrained type for one of the arguments of a data constructor, and allow the compiler to infer the roles for that type.
Expected behavior
The compiler takes into account any occurrences of the type's formal parameters within constrained types while inferring roles.
PureScript version
master