diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2016-02-04 10:42:56 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2016-02-24 13:31:30 -0500 |
commit | d8c64e86361f6766ebe26a262bb229fb8301a42a (patch) | |
tree | 94d68ebcb1cc6e9eabff08d3cd1d7e61dd99c01e /compiler/typecheck/TcSplice.hs | |
parent | ce36115b369510c51f402073174d82d0d1244589 (diff) | |
download | haskell-d8c64e86361f6766ebe26a262bb229fb8301a42a.tar.gz |
Address #11471 by putting RuntimeRep in kinds.wip/runtime-rep
See Note [TYPE] in TysPrim. There are still some outstanding
pieces in #11471 though, so this doesn't actually nail the bug.
This commit also contains a few performance improvements:
* Short-cut equality checking of nullary type syns
* Compare types before kinds in eqType
* INLINE coreViewOneStarKind
* Store tycon binders separately from kinds.
This resulted in a ~10% performance improvement in compiling
the Cabal package. No change in functionality other than
performance. (This affects the interface file format, though.)
This commit updates the haddock submodule.
Diffstat (limited to 'compiler/typecheck/TcSplice.hs')
-rw-r--r-- | compiler/typecheck/TcSplice.hs | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 921da07d2d..ac2ad01864 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1309,14 +1309,9 @@ reifyTyCon tc | isTypeFamilyTyCon tc = do { let tvs = tyConTyVars tc - kind = tyConKind tc + res_kind = tyConResKind tc resVar = famTcResVar tc - -- we need the *result kind* (see #8884) - (kvs, mono_kind) = splitForAllTys kind - -- tyConArity includes *kind* params - (_, res_kind) = splitFunTysN (tyConArity tc - length kvs) - mono_kind ; kind' <- reifyKind res_kind ; let (resultSig, injectivity) = case resVar of @@ -1351,13 +1346,8 @@ reifyTyCon tc | isDataFamilyTyCon tc = do { let tvs = tyConTyVars tc - kind = tyConKind tc + res_kind = tyConResKind tc - -- we need the *result kind* (see #8884) - (kvs, mono_kind) = splitForAllTys kind - -- tyConArity includes *kind* params - (_, res_kind) = splitFunTysN (tyConArity tc - length kvs) - mono_kind ; kind' <- fmap Just (reifyKind res_kind) ; tvs' <- reifyTyVars tvs (Just tc) @@ -1732,8 +1722,9 @@ reify_tc_app tc tys = do { tys' <- reifyTypes (filterOutInvisibleTypes tc tys) ; maybe_sig_t (mkThAppTs r_tc tys') } where - arity = tyConArity tc - tc_kind = tyConKind tc + arity = tyConArity tc + tc_binders = tyConBinders tc + tc_res_kind = tyConResKind tc r_tc | isTupleTyCon tc = if isPromotedDataCon tc then TH.PromotedTupleT arity @@ -1756,18 +1747,15 @@ reify_tc_app tc tys = return th_type needs_kind_sig - | Just result_ki <- peel_off_n_args tc_kind (length tys) - = not $ isEmptyVarSet $ filterVarSet isTyVar $ tyCoVarsOfType result_ki - | otherwise + | GT <- compareLength tys tc_binders + , tcIsTyVarTy tc_res_kind = True - - peel_off_n_args :: Kind -> Arity -> Maybe Kind - peel_off_n_args k 0 = Just k - peel_off_n_args k n - | Just (_, res_k) <- splitPiTy_maybe k - = peel_off_n_args res_k (n-1) | otherwise - = Nothing + = not $ + isEmptyVarSet $ + filterVarSet isTyVar $ + tyCoVarsOfType $ + mkForAllTys (dropList tys tc_binders) tc_res_kind reifyPred :: TyCoRep.PredType -> TcM TH.Pred reifyPred ty |