Note [CandidatesQTvs determinism and order]
* Determinism: when we quantify over type variables we decide the order in which they appear in the final type. Because the order of type variables in the type can end up in the interface file and affects some optimizations like worker-wrapper, we want this order to be deterministic. To achieve that we use deterministic sets of variables that can be converted to lists in a deterministic order. For more information about deterministic sets see Note [Deterministic UniqFM] in GHC.Types.Unique.DFM. * Order: as well as being deterministic, we use an accumulating-parameter style for candidateQTyVarsOfType so that we add variables one at a time, left to right. That means we tend to produce the variables in left-to-right order. This is just to make it bit more predictable for the programmer.
References 1
- Deterministic UniqFM GHC.Types.Unique.DFM
Referenced by 2
- GHC.Tc.Utils.TcMType call site ×2