Draft: checkEqForallVis
Prior to this change, the equality relation on types took ForAllTyFlag
into account, making a distinction between:
forall a. blah
forall a -> blah
Not anymore.
This distinction is important in surface Haskell, but it has no meaning in Core where type abstraction and type application are always explicit. At the same time, if we are not careful to track this flag, Core Lint will fail, as reported in #22762 (closed):
*** Core Lint errors : in result of TcGblEnv axioms ***
From-kind of Cast differs from kind of enclosed type
From-kind: forall (b :: Bool) -> *
Kind of enclosed type: forall {b :: Bool}. *
The solution is to compare types for equality modulo visibility (ForAllTyFlag
). Updated functions:
-
nonDetCmpType
(worker foreqType
) eqDeBruijnType
-
tc_eq_type
(worker fortcEqType
) can_eq_nc
In order to retain the distinction between visible and invisible forall in user-written code, we introduce a new ad-hoc check: checkEqForallVis
.