diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2021-11-08 19:11:58 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2021-11-08 19:14:13 -0500 |
commit | d7865c4e9fa139d5ba7a40211c1de3e30db0c2f5 (patch) | |
tree | 266ffaf0c32c95c5c7f3f5294284defcba228bbe /compiler/GHC/Tc/TyCl | |
parent | f8a98fd004769a0a0b700c34aee9df126797aa4b (diff) | |
download | haskell-wip/T20501.tar.gz |
Flesh out Note [The stupid context] and reference itwip/T20501
`Note [The stupid context]` in `GHC.Core.DataCon` talks about stupid contexts
from `DatatypeContexts`, but prior to this commit, it was rather outdated.
This commit spruces it up and references it from places where it is relevant.
Diffstat (limited to 'compiler/GHC/Tc/TyCl')
-rw-r--r-- | compiler/GHC/Tc/TyCl/Build.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Tc/TyCl/Utils.hs | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/TyCl/Build.hs b/compiler/GHC/Tc/TyCl/Build.hs index 7206fe70bd..4b44069950 100644 --- a/compiler/GHC/Tc/TyCl/Build.hs +++ b/compiler/GHC/Tc/TyCl/Build.hs @@ -192,6 +192,8 @@ buildDataCon fam_envs src_name declared_infix prom_info src_bangs impl_bangs -- the type variables mentioned in the arg_tys -- ToDo: Or functionally dependent on? -- This whole stupid theta thing is, well, stupid. +-- +-- See Note [The stupid context] in GHC.Core.DataCon. mkDataConStupidTheta :: TyCon -> [Type] -> [TyVar] -> [PredType] mkDataConStupidTheta tycon arg_tys univ_tvs | null stupid_theta = [] -- The common case diff --git a/compiler/GHC/Tc/TyCl/Utils.hs b/compiler/GHC/Tc/TyCl/Utils.hs index 1ce9ef8f82..347a7e57ff 100644 --- a/compiler/GHC/Tc/TyCl/Utils.hs +++ b/compiler/GHC/Tc/TyCl/Utils.hs @@ -906,7 +906,8 @@ mkOneRecordSelector all_cons idDetails fl has_sel || has_sel == NoFieldSelectors sel_ty | is_naughty = unitTy -- See Note [Naughty record selectors] | otherwise = mkForAllTys (tyVarSpecToBinders data_tvbs) $ - mkPhiTy (conLikeStupidTheta con1) $ -- Urgh! + -- Urgh! See Note [The stupid context] in GHC.Core.DataCon + mkPhiTy (conLikeStupidTheta con1) $ -- req_theta is empty for normal DataCon mkPhiTy req_theta $ mkVisFunTyMany data_ty $ |