Note [Comparing visibility]
We are sure that we want to distinguish (forall a. ty) and (forall a -> ty); see Note [ForAllTy and type equality]. But we have /three/ settings for the ForAllTyFlag: * Specified: forall a. ty * Inferred: forall {a}. ty * Required: forall a -> ty We could (and perhaps should) distinguish all three. But for now we distinguish Required from Specified/Inferred, and ignore the distinction between Specified and Inferred. The answer doesn't matter too much, provided we are consistent. And we are consistent because we always compare ForAllTyFlags with * `eqForAllVis` * `cmpForAllVis`. (You can only really check this by inspecting all pattern matches on ForAllTyFlags.) So if we change the decision, we just need to change those functions. Why don't we distinguish all three? Should GHC type-check the following program (adapted from #15740)? {-# LANGUAGE PolyKinds, ... #
References 1
- ForAllTy and type equality GHC.Core.TyCo.Compare
Referenced by 3
- Flag cast in data con wrappers GHC.Core.DataCon
- ForAllTy and type equality GHC.Core.TyCo.Compare
- Deep subsumption and required foralls GHC.Tc.Utils.Unify