@@ -28,7 +28,6 @@ import ConLike
28
28
import Data.Either (lefts , rights )
29
29
import DataCon
30
30
import FamInstEnv
31
- import FV
32
31
import HsSyn
33
32
import Name
34
33
import NameSet ( emptyNameSet )
@@ -45,8 +44,7 @@ import TysWiredIn ( eqTyConName, listTyConName, liftedTypeKindTyConName
45
44
import PrelNames ( hasKey , eqTyConKey , ipClassKey , tYPETyConKey
46
45
, liftedRepDataConKey )
47
46
import Unique ( getUnique )
48
- import Util ( chkAppend , compareLength , dropList , filterByList , filterOut
49
- , splitAtList )
47
+ import Util ( chkAppend ,dropList , filterByList , filterOut , splitAtList )
50
48
import Var
51
49
import VarSet
52
50
@@ -547,7 +545,7 @@ synifyType _ vs (TyConApp tc tys)
547
545
= noLoc (HsTyVar noExt NotPromoted (noLoc liftedTypeKindTyConName))
548
546
-- Use non-prefix tuple syntax where possible, because it looks nicer.
549
547
| Just sort <- tyConTuple_maybe tc
550
- , tyConArity tc == length tys
548
+ , tyConArity tc == tys_len
551
549
= noLoc $ HsTupleTy noExt
552
550
(case sort of
553
551
BoxedTuple -> HsBoxedTuple
@@ -604,32 +602,17 @@ synifyType _ vs (TyConApp tc tys)
604
602
(map (synifyType WithinType vs) $
605
603
filterOut isCoercionTy ty_args)
606
604
607
- vis_tys = filterOutInvisibleTypes tc tys
608
- binders = tyConBinders tc
609
- res_kind = tyConResKind tc
605
+ tys_len = length tys
606
+ vis_tys = filterOutInvisibleTypes tc tys
610
607
611
608
maybe_sig :: LHsType GhcRn -> LHsType GhcRn
612
609
maybe_sig ty'
613
- | needs_kind_sig
610
+ | tyConAppNeedsKindSig False tc tys_len
614
611
= let full_kind = typeKind (mkTyConApp tc tys)
615
612
full_kind' = synifyType WithinType vs full_kind
616
613
in noLoc $ HsKindSig noExt ty' full_kind'
617
614
| otherwise = ty'
618
615
619
- needs_kind_sig :: Bool
620
- needs_kind_sig
621
- | GT <- compareLength tys binders
622
- = False
623
- | otherwise
624
- = let (dropped_binders, remaining_binders)
625
- = splitAtList tys binders
626
- result_kind = mkTyConKind remaining_binders res_kind
627
- result_vars = tyCoVarsOfType result_kind
628
- dropped_vars = fvVarSet $
629
- mapUnionFV injectiveVarsOfBinder dropped_binders
630
-
631
- in not (subVarSet result_vars dropped_vars)
632
-
633
616
synifyType s vs (AppTy t1 (CoercionTy {})) = synifyType s vs t1
634
617
synifyType _ vs (AppTy t1 t2) = let
635
618
s1 = synifyType WithinType vs t1
0 commit comments