Note [Quick Look overview]
The implementation of Quick Look closely follows the QL paper A quick look at impredicativity, Serrano et al, ICFP 2020 https://www.microsoft.com/en-us/research/publication/a-quick-look-at-impredicativity/ All the moving parts are in this module, GHC.Tc.Gen.App, so named because it deal with n-ary application. The main workhorse is tcApp. Some notes relative to the paper (QL1) The "instantiation variables" of the paper are ordinary unification variables. We keep track of which variables are instantiation variables by giving them a TcLevel of QLInstVar, which is like "infinity". (QL2) When we learn what an instantiation variable must be, we simply unify it with that type; this is done in qlUnify, which is the function mgu_ql(t1,t2) of the paper. This may fill in a (mutable) instantiation variable with a polytype. (QL3) When QL is done, we turn the instantiation variables into ordinary unification variables, using qlZonkTcType. This function fully zonks the type (thereby revealing all the polytypes), and updates any instantiation variables with ordinary unification variables. See Note [Instantiation variables are short lived]. (QL4) We cleverly avoid the quadratic cost of QL, alluded to in the paper. See Note [Quick Look at value arguments]
References 2
- Instantiation variables are short lived GHC.Tc.Gen.App
- Quick Look at value arguments GHC.Tc.Gen.App
Referenced by 2
- The QLInstVar TcLevel GHC.Tc.Utils.TcType ×2