diff options
author | Richard Eisenberg <rae@cs.brynmawr.edu> | 2018-08-30 22:33:40 -0400 |
---|---|---|
committer | Richard Eisenberg <rae@cs.brynmawr.edu> | 2018-08-30 22:46:02 -0400 |
commit | 5d3eb646b08433587aa38694afcaee6863160e40 (patch) | |
tree | a7d43d4492f3e19e4ac4d12e83ed26488e6d8d1e | |
parent | 140563ff30ac3d36604d31409547bf229008552e (diff) | |
download | haskell-5d3eb646b08433587aa38694afcaee6863160e40.tar.gz |
Minor improvements to comments [skip ci]
-rw-r--r-- | compiler/typecheck/TcHsType.hs | 12 | ||||
-rw-r--r-- | compiler/types/FamInstEnv.hs | 6 |
2 files changed, 7 insertions, 11 deletions
diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index a70db2ebda..65c97dae8b 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1464,7 +1464,7 @@ kind-generalize correctly. In Step 4, we have to deal with the fact that metatyvars generated in the type may have a bumped TcLevel, because explicit foralls -raise the TcLevel. To avoid these variables from every being visible +raise the TcLevel. To avoid these variables from ever being visible in the surrounding context, we must obey the following dictum: Every metavariable in a type must either be @@ -1476,18 +1476,20 @@ has a proper TcLevel. (I'm ignoring the TcLevel on a skolem here, as it's not really in play here.) On the other hand, if it is not generalized (because we're not generalizing the construct -- e.g., pattern sig -- or because the metavars are constrained -- see kindGeneralizeLocal) -we need to promote to (MetaTvInv) of Note [TcLevel and untouchable type variables] +we need to promote to maintain (MetaTvInv) of Note [TcLevel and untouchable type variables] in TcType. After promoting/generalizing, we need to zonk *again* because both promoting and generalizing fill in metavariables. To avoid the double-zonk, we do two things: - 1. zonkPromoteType and friends zonk and promote at the same time. - Accordingly, the function does setps 3-5 all at once, preventing + 1. When we're not generalizing: + zonkPromoteType and friends zonk and promote at the same time. + Accordingly, the function does steps 3-5 all at once, preventing the need for multiple traversals. - 2. kindGeneralize does not require a zonked type -- it zonks as it + 2. When we are generalizing: + kindGeneralize does not require a zonked type -- it zonks as it gathers free variables. So this way effectively sidesteps step 3. -} diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index a59f9a684e..636c0dac44 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -1273,12 +1273,6 @@ topNormaliseType_maybe env ty tyFamStepper rec_nts tc tys -- Try to step a type/data family = let (args_co, ntys) = normaliseTcArgs env Representational tc tys in - -- NB: It's OK to use normaliseTcArgs here instead of - -- normalise_tc_args (which takes the LiftingContext described - -- in Note [Normalising types]) because the reduceTyFamApp below - -- works only at top level. We'll never recur in this function - -- after reducing the kind of a bound tyvar. - case reduceTyFamApp_maybe env Representational tc ntys of Just (co, rhs) -> NS_Step rec_nts rhs (args_co `mkTransCo` co) _ -> NS_Done |