summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-10-31 08:29:08 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2020-10-31 12:00:01 -0400
commit3e070cffc16ab6817b4cb6bb64f5bedabbe51da9 (patch)
treeb2c6e075d0edd3e682cefeed7ff2a4aa78441b5e /compiler/GHC/Tc/Module.hs
parent08e6993a1b956e6edccdc1cecc7250b724bf79a0 (diff)
downloadhaskell-wip/T13795-T18828.tar.gz
Expand type synonyms with :kind!wip/T13795-T18828
The User's Guide claims that `:kind!` should expand type synonyms, but GHCi wasn't doing this in practice. Let's just update the implementation to match the specification in the User's Guide. Fixes #13795. Fixes #18828. Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
Diffstat (limited to 'compiler/GHC/Tc/Module.hs')
-rw-r--r--compiler/GHC/Tc/Module.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 94582b00a9..2d44a9aacf 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -2629,12 +2629,13 @@ tcRnType hsc_env flexi normalise rdr_type
-- Do validity checking on type
; checkValidType (GhciCtxt True) ty
- ; ty' <- if normalise
- then do { fam_envs <- tcGetFamInstEnvs
- ; let (_, ty')
- = normaliseType fam_envs Nominal ty
- ; return ty' }
- else return ty ;
+ -- Optionally (:k vs :k!) normalise the type. Does two things:
+ -- normaliseType: expand type-family applications
+ -- expandTypeSynonyms: expand type synonyms (#18828)
+ ; fam_envs <- tcGetFamInstEnvs
+ ; let ty' | normalise = expandTypeSynonyms $ snd $
+ normaliseType fam_envs Nominal ty
+ | otherwise = ty
; return (ty', mkInfForAllTys kvs (tcTypeKind ty')) }