diff options
61 files changed, 250 insertions, 178 deletions
diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs index 75b17ef039..eff8c5f51b 100644 --- a/compiler/typecheck/Inst.hs +++ b/compiler/typecheck/Inst.hs @@ -54,7 +54,7 @@ import Class( Class ) import MkId( mkDictFunId ) import Id import Name -import Var ( EvVar, mkTyVar, TyVarBndr(..) ) +import Var ( EvVar, mkTyVar, tyVarName, TyVarBndr(..) ) import DataCon import TyCon import VarEnv @@ -129,31 +129,37 @@ ToDo: this eta-abstraction plays fast and loose with termination, fix this -} -deeplySkolemise - :: TcSigmaType - -> TcM ( HsWrapper - , [TyVar] -- all skolemised variables - , [EvVar] -- all "given"s - , TcRhoType) +deeplySkolemise :: TcSigmaType + -> TcM ( HsWrapper + , [(Name,TyVar)] -- All skolemised variables + , [EvVar] -- All "given"s + , TcRhoType ) deeplySkolemise ty - | Just (arg_tys, tvs, theta, ty') <- tcDeepSplitSigmaTy_maybe ty - = do { ids1 <- newSysLocalIds (fsLit "dk") arg_tys - ; (subst, tvs1) <- tcInstSkolTyVars tvs - ; ev_vars1 <- newEvVars (substThetaUnchecked subst theta) - ; (wrap, tvs2, ev_vars2, rho) <- - deeplySkolemise (substTyAddInScope subst ty') - ; return ( mkWpLams ids1 - <.> mkWpTyLams tvs1 - <.> mkWpLams ev_vars1 - <.> wrap - <.> mkWpEvVarApps ids1 - , tvs1 ++ tvs2 - , ev_vars1 ++ ev_vars2 - , mkFunTys arg_tys rho ) } + = go init_subst ty + where + init_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType ty)) + + go subst ty + | Just (arg_tys, tvs, theta, ty') <- tcDeepSplitSigmaTy_maybe ty + = do { let arg_tys' = substTys subst arg_tys + ; ids1 <- newSysLocalIds (fsLit "dk") arg_tys' + ; (subst', tvs1) <- tcInstSkolTyVarsX subst tvs + ; ev_vars1 <- newEvVars (substTheta subst' theta) + ; (wrap, tvs_prs2, ev_vars2, rho) <- go subst' ty' + ; let tv_prs1 = map tyVarName tvs `zip` tvs1 + ; return ( mkWpLams ids1 + <.> mkWpTyLams tvs1 + <.> mkWpLams ev_vars1 + <.> wrap + <.> mkWpEvVarApps ids1 + , tv_prs1 ++ tvs_prs2 + , ev_vars1 ++ ev_vars2 + , mkFunTys arg_tys' rho ) } - | otherwise - = return (idHsWrapper, [], [], ty) + | otherwise + = return (idHsWrapper, [], [], substTy subst ty) + -- substTy is a quick no-op on an empty substitution -- | Instantiate all outer type variables -- and any context. Never looks through arrows. diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 201da00504..942bf96988 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -687,13 +687,13 @@ tcPolyCheck prag_fn , fun_matches = matches })) = setSrcSpan sig_loc $ do { traceTc "tcPolyCheck" (ppr poly_id $$ ppr sig_loc) - ; (tv_prs, theta, tau) <- tcInstType (tcInstSigTyVars sig_loc) poly_id + ; (tv_prs, theta, tau) <- tcInstType tcInstSkolTyVars poly_id -- See Note [Instantiate sig with fresh variables] ; mono_name <- newNameAt (nameOccName name) nm_loc ; ev_vars <- newEvVars theta ; let mono_id = mkLocalId mono_name tau - skol_info = SigSkol ctxt (mkPhiTy theta tau) + skol_info = SigSkol ctxt (idType poly_id) tv_prs skol_tvs = map snd tv_prs ; (ev_binds, (co_fn, matches')) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index d47ecc6315..4bcf67316b 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -2329,7 +2329,7 @@ ctxtFixes has_ambig_tvs pred implics , isTyVarClassPred pred , (skol:skols) <- usefulContext implics pred , let what | null skols - , SigSkol (PatSynCtxt {}) _ <- skol + , SigSkol (PatSynCtxt {}) _ _ <- skol = text "\"required\"" | otherwise = empty @@ -2351,8 +2351,8 @@ discardProvCtxtGivens orig givens -- See Note [discardProvCtxtGivens] | otherwise = givens where - discard n (Implic { ic_info = SigSkol (PatSynCtxt n') _ }) = n == n' - discard _ _ = False + discard n (Implic { ic_info = SigSkol (PatSynCtxt n') _ _ }) = n == n' + discard _ _ = False usefulContext :: [Implication] -> PredType -> [SkolemInfo] -- usefulContext picks out the implications whose context @@ -2375,8 +2375,8 @@ usefulContext implics pred | implausible_info (ic_info ic) = True | otherwise = False - implausible_info (SigSkol (InfSigCtxt {}) _) = True - implausible_info _ = False + implausible_info (SigSkol (InfSigCtxt {}) _ _) = True + implausible_info _ = False -- Do not suggest adding constraints to an *inferred* type signature {- Note [Report candidate instances] @@ -2600,13 +2600,10 @@ mkAmbigMsg prepend_msg ct pprSkol :: [Implication] -> TcTyVar -> SDoc pprSkol implics tv = case skol_info of - UnkSkol -> quotes (ppr tv) <+> text "is an unknown type variable" - SigSkol ctxt ty -> ppr_rigid (pprSigSkolInfo ctxt - (mkSpecForAllTys skol_tvs ty)) - _ -> ppr_rigid (pprSkolInfo skol_info) + UnkSkol -> quotes (ppr tv) <+> text "is an unknown type variable" + _ -> ppr_rigid (pprSkolInfo skol_info) where - Implic { ic_skols = skol_tvs, ic_info = skol_info } - = getSkolemInfo implics tv + Implic { ic_info = skol_info } = getSkolemInfo implics tv ppr_rigid pp_info = hang (quotes (ppr tv) <+> text "is a rigid type variable bound by") 2 (sep [ pp_info diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 6c9b5a2b1c..3bc6457e6e 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -1490,9 +1490,9 @@ in the other order, the extra signature in f2 is reqd. tcExprSig :: LHsExpr Name -> TcIdSigInfo -> TcM (LHsExpr TcId, TcType) tcExprSig expr (CompleteSig { sig_bndr = poly_id, sig_loc = loc }) = setSrcSpan loc $ -- Sets the location for the implication constraint - do { (tv_prs, theta, tau) <- tcInstType (tcInstSigTyVars loc) poly_id + do { (tv_prs, theta, tau) <- tcInstType tcInstSkolTyVars poly_id ; given <- newEvVars theta - ; let skol_info = SigSkol ExprSigCtxt (mkPhiTy theta tau) + ; let skol_info = SigSkol ExprSigCtxt (idType poly_id) tv_prs skol_tvs = map snd tv_prs ; (ev_binds, expr') <- checkConstraints skol_info skol_tvs given $ tcExtendTyVarEnv2 tv_prs $ diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index b0a9d4966d..2abc800a37 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -57,8 +57,8 @@ module TcMType ( newMetaSigTyVars, newMetaSigTyVarX, newSigTyVar, newWildCardX, tcInstType, - tcInstSkolTyVars, tcInstSuperSkolTyVarsX, - tcInstSigTyVars, + tcInstSkolTyVars,tcInstSkolTyVarsX, + tcInstSuperSkolTyVarsX, tcSkolDFunType, tcSuperSkolTyVars, instSkolTyCoVars, freshenTyVarBndrs, freshenCoVarBndrsX, @@ -108,6 +108,7 @@ import VarSet import TysWiredIn import TysPrim import VarEnv +import NameEnv import PrelNames import Util import Outputable @@ -478,7 +479,10 @@ tcSuperSkolTyVar subst tv -- skolems are non-overlappable; see Note [Overlap and deriving] -- for an example where this matters. tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar]) -tcInstSkolTyVars = tcInstSkolTyVars' False emptyTCvSubst +tcInstSkolTyVars = tcInstSkolTyVarsX emptyTCvSubst + +tcInstSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar]) +tcInstSkolTyVarsX = tcInstSkolTyVars' False tcInstSuperSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar]) tcInstSuperSkolTyVars = tcInstSuperSkolTyVarsX emptyTCvSubst @@ -503,12 +507,6 @@ mkTcSkolTyVar lvl loc overlappable details = SkolemTv (pushTcLevel lvl) overlappable -- NB: skolems bump the level -tcInstSigTyVars :: SrcSpan -> [TyVar] - -> TcM (TCvSubst, [TcTyVar]) -tcInstSigTyVars loc tvs - = do { lvl <- getTcLevel - ; instSkolTyCoVars (mkTcSkolTyVar lvl loc False) tvs } - ------------------ freshenTyVarBndrs :: [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TyVar]) -- ^ Give fresh uniques to a bunch of TyVars, but they stay @@ -1417,8 +1415,8 @@ zonkCtEvidence ctev@(CtDerived { ctev_pred = pred }) ; return (ctev { ctev_pred = pred' }) } zonkSkolemInfo :: SkolemInfo -> TcM SkolemInfo -zonkSkolemInfo (SigSkol cx ty) = do { ty' <- zonkTcType ty - ; return (SigSkol cx ty') } +zonkSkolemInfo (SigSkol cx ty tv_prs) = do { ty' <- zonkTcType ty + ; return (SigSkol cx ty' tv_prs) } zonkSkolemInfo (InferSkol ntys) = do { ntys' <- mapM do_one ntys ; return (InferSkol ntys') } where @@ -1606,11 +1604,39 @@ tidyEvVar env var = setVarType var (tidyType env (varType var)) ---------------- tidySkolemInfo :: TidyEnv -> SkolemInfo -> SkolemInfo -tidySkolemInfo env (DerivSkol ty) = DerivSkol (tidyType env ty) -tidySkolemInfo env (SigSkol cx ty) = SigSkol cx (tidyType env ty) -tidySkolemInfo env (InferSkol ids) = InferSkol (mapSnd (tidyType env) ids) -tidySkolemInfo env (UnifyForAllSkol ty) = UnifyForAllSkol (tidyType env ty) -tidySkolemInfo _ info = info +tidySkolemInfo env (DerivSkol ty) = DerivSkol (tidyType env ty) +tidySkolemInfo env (SigSkol cx ty tv_prs) = tidySigSkol env cx ty tv_prs +tidySkolemInfo env (InferSkol ids) = InferSkol (mapSnd (tidyType env) ids) +tidySkolemInfo env (UnifyForAllSkol ty) = UnifyForAllSkol (tidyType env ty) +tidySkolemInfo _ info = info + +tidySigSkol :: TidyEnv -> UserTypeCtxt + -> TcType -> [(Name,TcTyVar)] -> SkolemInfo +-- We need to take special care when tidying SigSkol +-- See Note [SigSkol SkolemInfo] in TcRnTypes +tidySigSkol env cx ty tv_prs + = SigSkol cx (tidy_ty env ty) tv_prs' + where + tv_prs' = mapSnd (tidyTyVarOcc env) tv_prs + inst_env = mkNameEnv tv_prs' + + tidy_ty env (ForAllTy (TvBndr tv vis) ty) + = ForAllTy (TvBndr tv' vis) (tidy_ty env' ty) + where + (env', tv') = tidy_tv_bndr env tv + + tidy_ty env (FunTy arg res) + = FunTy (tidyType env arg) (tidy_ty env res) + + tidy_ty env ty = tidyType env ty + + tidy_tv_bndr :: TidyEnv -> TyVar -> (TidyEnv, TyVar) + tidy_tv_bndr env@(occ_env, subst) tv + | Just tv' <- lookupNameEnv inst_env (tyVarName tv) + = ((occ_env, extendVarEnv subst tv tv'), tv') + + | otherwise + = tidyTyCoVarBndr env tv ------------------------------------------------------------------------- {- diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index b6af02b129..cdf327802f 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1661,7 +1661,7 @@ check_main dflags tcg_env explicit_mod_hdr ; ioTyCon <- tcLookupTyCon ioTyConName ; res_ty <- newFlexiTyVarTy liftedTypeKind ; let io_ty = mkTyConApp ioTyCon [res_ty] - skol_info = SigSkol (FunSigCtxt main_name False) io_ty + skol_info = SigSkol (FunSigCtxt main_name False) io_ty [] ; (ev_binds, main_expr) <- checkConstraints skol_info [] [] $ addErrCtxt mainCtxt $ diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 48c9c3577f..b6443340fd 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -2841,9 +2841,14 @@ pushErrCtxtSameOrigin err loc@(CtLoc { ctl_env = lcl }) -- a) type variables are skolemised -- b) an implication constraint is generated data SkolemInfo - = SigSkol UserTypeCtxt -- A skolem that is created by instantiating - TcType -- a programmer-supplied type signature - -- Location of the binding site is on the TyVar + = SigSkol -- A skolem that is created by instantiating + -- a programmer-supplied type signature + -- Location of the binding site is on the TyVar + -- See Note [SigSkol SkolemInfo] + UserTypeCtxt -- What sort of signature + TcType -- Original type signature (before skolemisation) + [(Name,TcTyVar)] -- Maps the original name of the skolemised tyvar + -- to its instantiated version | ClsSkol Class -- Bound at a class decl @@ -2898,9 +2903,9 @@ termEvidenceAllowed _ = True pprSkolInfo :: SkolemInfo -> SDoc -- Complete the sentence "is a rigid type variable bound by..." -pprSkolInfo (SigSkol ctxt ty) = pprSigSkolInfo ctxt ty +pprSkolInfo (SigSkol cx ty _) = pprSigSkolInfo cx ty pprSkolInfo (IPSkol ips) = text "the implicit-parameter binding" <> plural ips <+> text "for" - <+> pprWithCommas ppr ips + <+> pprWithCommas ppr ips pprSkolInfo (ClsSkol cls) = text "the class declaration for" <+> quotes (ppr cls) pprSkolInfo (DerivSkol pred) = text "the deriving clause for" <+> quotes (ppr pred) pprSkolInfo InstSkol = text "the instance declaration" @@ -2923,6 +2928,7 @@ pprSkolInfo (UnifyForAllSkol ty) = text "the type" <+> ppr ty pprSkolInfo UnkSkol = WARN( True, text "pprSkolInfo: UnkSkol" ) text "UnkSkol" pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc +-- The type is already tidied pprSigSkolInfo ctxt ty = case ctxt of FunSigCtxt f _ -> vcat [ text "the type signature for:" @@ -2948,13 +2954,38 @@ pprPatSkolInfo (PatSynCon ps) {- Note [Skolem info for pattern synonyms] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For pattern synonym SkolemInfo we have - SigSkol (PatSynCtxt p) ty + SigSkol (PatSynCtxt p) ty _ but the type 'ty' is not very helpful. The full pattern-synonym type -is has the provided and required pieces, which it is inconvenient to +has the provided and required pieces, which it is inconvenient to record and display here. So we simply don't display the type at all, contenting outselves with just the name of the pattern synonym, which is fine. We could do more, but it doesn't seem worth it. +Note [SigSkol SkolemInfo] +~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose we (deeply) skolemise a type + f :: forall a. a -> forall b. b -> a +Then we'll instantiate [a :-> a', b :-> b'], and with the instantiated + a' -> b' -> a. +But when, in an error message, we report that "b is a rigid type +variable bound by the type signature for f", we want to show the foralls +in the right place. So we proceed as follows: + +* In SigSkol we record + - the original signature forall a. a -> forall b. b -> a + - the instantiation mapping [a :-> a', b :-> b'] + +* Then when tidying in TcMType.tidySkolemInfo, we first tidy a' to + whatever it tidies to, say a''; and then we walk over the type + replacing the binder a by the tidied version a'', to give + forall a''. a'' -> forall b''. b'' -> a'' + We need to do this under function arrows, to match what deeplySkolemise + does. + +* Typically a'' will have a nice pretty name like "a", but the point is + that the foral-bound variables of the signature we report line up with + the instantiated skolems lying around in other types. + ************************************************************************ * * diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 4402d8f4de..e2598b5214 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -1391,7 +1391,7 @@ setImplicationStatus implic@(Implic { ic_binds = ev_binds_var = Left ic warnRedundantGivens :: SkolemInfo -> Bool -warnRedundantGivens (SigSkol ctxt _) +warnRedundantGivens (SigSkol ctxt _ _) = case ctxt of FunSigCtxt _ warn_redundant -> warn_redundant ExprSigCtxt -> True diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index 75732c6f05..acfb0b7a0c 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -719,15 +719,13 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected | not (isPredTy act_arg) , not (isPredTy exp_arg) = -- See Note [Co/contra-variance of subsumption checking] - do { res_wrap <- tc_sub_type_ds eq_orig inst_orig ctxt act_res exp_res - ; arg_wrap - <- tc_sub_tc_type eq_orig (GivenOrigin - (SigSkol GenSigCtxt exp_arg)) - ctxt exp_arg act_arg + do { res_wrap <- tc_sub_type_ds eq_orig inst_orig ctxt act_res exp_res + ; arg_wrap <- tc_sub_tc_type eq_orig given_orig ctxt exp_arg act_arg ; return (mkWpFun arg_wrap res_wrap exp_arg exp_res doc) } -- arg_wrap :: exp_arg ~> act_arg -- res_wrap :: act-res ~> exp_res where + given_orig = GivenOrigin (SigSkol GenSigCtxt exp_arg []) doc = text "When checking that" <+> quotes (ppr ty_actual) <+> text "is more polymorphic than" <+> quotes (ppr ty_expected) @@ -1040,14 +1038,14 @@ tcSkolemise ctxt expected_ty thing_inside -- We expect expected_ty to be a forall-type -- If not, the call is a no-op = do { traceTc "tcSkolemise" Outputable.empty - ; (wrap, tvs', given, rho') <- deeplySkolemise expected_ty + ; (wrap, tv_prs, given, rho') <- deeplySkolemise expected_ty ; lvl <- getTcLevel ; when debugIsOn $ traceTc "tcSkolemise" $ vcat [ ppr lvl, text "expected_ty" <+> ppr expected_ty, - text "inst tyvars" <+> ppr tvs', + text "inst tyvars" <+> ppr tv_prs, text "given" <+> ppr given, text "inst type" <+> ppr rho' ] @@ -1064,9 +1062,8 @@ tcSkolemise ctxt expected_ty thing_inside -- TcTyVars, all this is handled automatically with no need for -- extra faffing around - -- Use the *instantiated* type in the SkolemInfo - -- so that the names of displayed type variables line up - ; let skol_info = SigSkol ctxt (mkFunTys (map varType given) rho') + ; let tvs' = map snd tv_prs + skol_info = SigSkol ctxt expected_ty tv_prs ; (ev_binds, result) <- checkConstraints skol_info tvs' given $ thing_inside tvs' rho' diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 967e6f7268..494d66ab0d 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2118,7 +2118,8 @@ checkValidSubst subst@(TCvSubst in_scope tenv cenv) tys cos a substTy :: HasCallStack => TCvSubst -> Type -> Type substTy subst ty | isEmptyTCvSubst subst = ty - | otherwise = checkValidSubst subst [ty] [] $ subst_ty subst ty + | otherwise = checkValidSubst subst [ty] [] $ + subst_ty subst ty -- | Substitute within a 'Type' disabling the sanity checks. -- The problems that the sanity checks in substTy catch are described in diff --git a/testsuite/tests/ado/ado005.stderr b/testsuite/tests/ado/ado005.stderr index 90d0b023bf..a7984b4757 100644 --- a/testsuite/tests/ado/ado005.stderr +++ b/testsuite/tests/ado/ado005.stderr @@ -1,21 +1,25 @@ ado005.hs:8:3: error: - Could not deduce (Monad f) arising from a do statement - from the context: Applicative f - bound by the type signature for: - test :: Applicative f => (Int -> f Int) -> f Int - at ado005.hs:6:1-48 - Possible fix: - add (Monad f) to the context of - the type signature for: - test :: Applicative f => (Int -> f Int) -> f Int - In a stmt of a 'do' block: x <- f 3 - In the expression: - do x <- f 3 - y <- f x - return (x + y) - In an equation for ‘test’: - test f - = do x <- f 3 - y <- f x - return (x + y) + • Could not deduce (Monad f) arising from a do statement + from the context: Applicative f + bound by the type signature for: + test :: forall (f :: * -> *). + Applicative f => + (Int -> f Int) -> f Int + at ado005.hs:6:1-48 + Possible fix: + add (Monad f) to the context of + the type signature for: + test :: forall (f :: * -> *). + Applicative f => + (Int -> f Int) -> f Int + • In a stmt of a 'do' block: x <- f 3 + In the expression: + do x <- f 3 + y <- f x + return (x + y) + In an equation for ‘test’: + test f + = do x <- f 3 + y <- f x + return (x + y) diff --git a/testsuite/tests/backpack/should_fail/bkpfail24.stderr b/testsuite/tests/backpack/should_fail/bkpfail24.stderr index 53312d23fe..ef6a7d6c01 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail24.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail24.stderr @@ -7,7 +7,7 @@ bkpfail24.bkp:14:15: error: • Could not deduce: a ~ b from the context: {H1.T} ~ {H2.T} bound by the type signature for: - f :: {H1.T} ~ {H2.T} => a -> b + f :: forall a b. {H1.T} ~ {H2.T} => a -> b at bkpfail24.bkp:13:9-34 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/backpack/should_fail/bkpfail44.stderr b/testsuite/tests/backpack/should_fail/bkpfail44.stderr index 127083f453..c16b2f2527 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail44.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail44.stderr @@ -6,7 +6,7 @@ bkpfail44.bkp:10:15: error: • Could not deduce: a ~ b from the context: Coercible (T a) (T b) bound by the type signature for: - f :: Coercible (T a) (T b) => a -> b + f :: forall a b. Coercible (T a) (T b) => a -> b at bkpfail44.bkp:9:9-44 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/deriving/should_fail/T5287.stderr b/testsuite/tests/deriving/should_fail/T5287.stderr index 6307c36f24..20ad31dec3 100644 --- a/testsuite/tests/deriving/should_fail/T5287.stderr +++ b/testsuite/tests/deriving/should_fail/T5287.stderr @@ -3,7 +3,7 @@ T5287.hs:6:10: error: • Could not deduce (A a oops0) from the context: A a oops bound by an instance declaration: - A a oops => Read (D a) + forall a oops. A a oops => Read (D a) at T5287.hs:6:10-31 The type variable ‘oops0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr index 596b6e2612..32e0138fe6 100644 --- a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr +++ b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr @@ -4,7 +4,7 @@ PushedInAsGivens.hs:10:31: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - foo :: F Int ~ [a1] => a1 -> Int + foo :: forall a1. F Int ~ [a1] => a1 -> Int at PushedInAsGivens.hs:9:13-44 • In the expression: y In the first argument of ‘length’, namely ‘[x, y]’ diff --git a/testsuite/tests/indexed-types/should_compile/T3208b.stderr b/testsuite/tests/indexed-types/should_compile/T3208b.stderr index c017701a27..063870465b 100644 --- a/testsuite/tests/indexed-types/should_compile/T3208b.stderr +++ b/testsuite/tests/indexed-types/should_compile/T3208b.stderr @@ -4,7 +4,9 @@ T3208b.hs:15:15: error: arising from a use of ‘apply’ from the context: (OTerm a ~ STerm a, OBJECT a, SUBST a) bound by the type signature for: - fce' :: (OTerm a ~ STerm a, OBJECT a, SUBST a) => a -> c + fce' :: forall a c. + (OTerm a ~ STerm a, OBJECT a, SUBST a) => + a -> c at T3208b.hs:14:1-56 The type variable ‘o0’ is ambiguous • In the first argument of ‘fce’, namely ‘(apply f)’ diff --git a/testsuite/tests/indexed-types/should_fail/T2664.stderr b/testsuite/tests/indexed-types/should_fail/T2664.stderr index 1217196f8a..21fbb64e3c 100644 --- a/testsuite/tests/indexed-types/should_fail/T2664.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2664.stderr @@ -3,7 +3,8 @@ T2664.hs:31:9: error: • Could not deduce: Dual a ~ Dual b from the context: ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) bound by the type signature for: - newPChan :: ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) => + newPChan :: forall c. + ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) => IO (PChan (a :*: b), PChan c) at T2664.hs:23:5-12 Expected type: IO (PChan (a :*: b), PChan c) diff --git a/testsuite/tests/indexed-types/should_fail/T4093a.stderr b/testsuite/tests/indexed-types/should_fail/T4093a.stderr index 64589234d6..7b2d92f8ed 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093a.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4093a.stderr @@ -3,7 +3,7 @@ T4093a.hs:8:8: error: • Could not deduce: e ~ () from the context: Foo e ~ Maybe e bound by the type signature for: - hang :: Foo e ~ Maybe e => Foo e + hang :: forall e. Foo e ~ Maybe e => Foo e at T4093a.hs:7:1-34 ‘e’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/indexed-types/should_fail/T4093b.stderr b/testsuite/tests/indexed-types/should_fail/T4093b.stderr index 1796ed1c52..195b113ede 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093b.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4093b.stderr @@ -4,7 +4,8 @@ T4093b.hs:31:13: error: from the context: (EitherCO e (A C O n) (A O O n) ~ A e O n, EitherCO x (A C C n) (A C O n) ~ A C x n) bound by the type signature for: - blockToNodeList :: (EitherCO e (A C O n) (A O O n) ~ A e O n, + blockToNodeList :: forall (n :: * -> * -> *) e x. + (EitherCO e (A C O n) (A O O n) ~ A e O n, EitherCO x (A C C n) (A C O n) ~ A C x n) => Block n e x -> A e x n at T4093b.hs:(19,1)-(22,26) diff --git a/testsuite/tests/indexed-types/should_fail/T7194.stderr b/testsuite/tests/indexed-types/should_fail/T7194.stderr index c48a3de15d..d509f9fac9 100644 --- a/testsuite/tests/indexed-types/should_fail/T7194.stderr +++ b/testsuite/tests/indexed-types/should_fail/T7194.stderr @@ -4,7 +4,7 @@ T7194.hs:18:35: error: because type variable ‘a’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - g :: C (F a) => a -> Int + g :: forall a. C (F a) => a -> Int at T7194.hs:17:18-41 • In the expression: foo y In the first argument of ‘length’, namely ‘[x, foo y]’ diff --git a/testsuite/tests/monadfail/MonadFailErrors.stderr b/testsuite/tests/monadfail/MonadFailErrors.stderr index 1507984d14..81ad56c910 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.stderr +++ b/testsuite/tests/monadfail/MonadFailErrors.stderr @@ -5,12 +5,12 @@ MonadFailErrors.hs:16:5: error: with the failable pattern ‘Just x’ from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailErrors.hs:14:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined diff --git a/testsuite/tests/monadfail/MonadFailWarnings.stderr b/testsuite/tests/monadfail/MonadFailWarnings.stderr index ac16d6cd9e..7471bd9373 100644 --- a/testsuite/tests/monadfail/MonadFailWarnings.stderr +++ b/testsuite/tests/monadfail/MonadFailWarnings.stderr @@ -5,12 +5,12 @@ MonadFailWarnings.hs:19:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) (this will become an error in a future GHC release) from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailWarnings.hs:17:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr index 4cd52315f0..44bc014f84 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr @@ -16,7 +16,7 @@ overloadedlabelsfail01.hs:14:5: error: arising from the overloaded label ‘#y’ from the context: IsLabel "x" t bound by the type signature for: - c :: IsLabel "x" t => t + c :: forall t. IsLabel "x" t => t at overloadedlabelsfail01.hs:13:1-23 • In the expression: #y In an equation for ‘c’: c = #y diff --git a/testsuite/tests/parser/should_fail/T7848.stderr b/testsuite/tests/parser/should_fail/T7848.stderr index fe949d944a..95ac7374ef 100644 --- a/testsuite/tests/parser/should_fail/T7848.stderr +++ b/testsuite/tests/parser/should_fail/T7848.stderr @@ -9,7 +9,7 @@ T7848.hs:10:9: error: because type variable ‘a’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - (&) :: a + (&) :: forall a. a at T7848.hs:10:9-35 • In the SPECIALISE pragma {-# SPECIALIZE (&) :: a #-} In an equation for ‘x’: diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index 3027d17d1b..d397e1f6ba 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -53,7 +53,7 @@ T10403.hs:28:8: warning: [-Wdeferred-type-errors (in -Wdefault)] because type variable ‘t’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - app2 :: H (B t) + app2 :: forall t. H (B t) at T10403.hs:27:1-15 Expected type: H (B t) Actual type: H f0 diff --git a/testsuite/tests/polykinds/T7230.stderr b/testsuite/tests/polykinds/T7230.stderr index 0ca0310a00..f0a29bb2d6 100644 --- a/testsuite/tests/polykinds/T7230.stderr +++ b/testsuite/tests/polykinds/T7230.stderr @@ -3,7 +3,9 @@ T7230.hs:48:32: error: • Could not deduce: (x :<<= x1) ~ 'True from the context: Increasing xs ~ 'True bound by the type signature for: - crash :: Increasing xs ~ 'True => SList xs -> SBool (Increasing xs) + crash :: forall (xs :: [Nat]). + Increasing xs ~ 'True => + SList xs -> SBool (Increasing xs) at T7230.hs:47:1-68 or from: xs ~ (x : xs1) bound by a pattern with constructor: diff --git a/testsuite/tests/polykinds/T7594.stderr b/testsuite/tests/polykinds/T7594.stderr index be52e41d31..3ea08a3fb8 100644 --- a/testsuite/tests/polykinds/T7594.stderr +++ b/testsuite/tests/polykinds/T7594.stderr @@ -4,7 +4,7 @@ T7594.hs:35:12: error: ‘b’ is untouchable inside the constraints: (:&:) c0 Real a bound by a type expected by the context: - (:&:) c0 Real a => a -> b + forall a. (:&:) c0 Real a => a -> b at T7594.hs:35:8-19 ‘b’ is a rigid type variable bound by the inferred type of bar2 :: b at T7594.hs:35:1-19 diff --git a/testsuite/tests/typecheck/should_compile/T7220a.stderr b/testsuite/tests/typecheck/should_compile/T7220a.stderr index 6e25e7a8f1..a1e865f131 100644 --- a/testsuite/tests/typecheck/should_compile/T7220a.stderr +++ b/testsuite/tests/typecheck/should_compile/T7220a.stderr @@ -3,13 +3,12 @@ T7220a.hs:17:6: error: • Could not deduce (C a b) from the context: (C a0 b, TF b ~ Y) bound by the type signature for: - f :: (C a0 b, TF b ~ Y) => b + f :: forall b. (C a0 b, TF b ~ Y) => b at T7220a.hs:17:6-44 Possible fix: add (C a b) to the context of the type signature for: - f :: (C a0 b, TF b ~ Y) => b + f :: forall b. (C a0 b, TF b ~ Y) => b • In the ambiguity check for ‘f’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - f :: (forall b. (C a b, TF b ~ Y) => b) -> X + In the type signature: f :: (forall b. (C a b, TF b ~ Y) => b) -> X diff --git a/testsuite/tests/typecheck/should_compile/T9834.stderr b/testsuite/tests/typecheck/should_compile/T9834.stderr index 8fb1db79a8..303b1defe6 100644 --- a/testsuite/tests/typecheck/should_compile/T9834.stderr +++ b/testsuite/tests/typecheck/should_compile/T9834.stderr @@ -30,9 +30,7 @@ T9834.hs:23:10: warning: [-Wdeferred-type-errors (in -Wdefault)] at T9834.hs:22:11-74 ‘a1’ is a rigid type variable bound by a type expected by the context: - forall (q :: * -> *) a1. - Applicative q => - Comp p q a1 -> Comp p q a1 + forall (q :: * -> *). Applicative q => Nat (Comp p q) (Comp p q) at T9834.hs:23:10-19 Expected type: Comp p q a1 -> Comp p q a1 Actual type: Comp p q a -> Comp p q a diff --git a/testsuite/tests/typecheck/should_compile/T9939.stderr b/testsuite/tests/typecheck/should_compile/T9939.stderr index c4866790c8..2ebc927006 100644 --- a/testsuite/tests/typecheck/should_compile/T9939.stderr +++ b/testsuite/tests/typecheck/should_compile/T9939.stderr @@ -2,19 +2,19 @@ T9939.hs:6:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f1 :: (Eq a, Ord a) => a -> a -> Bool + f1 :: forall a. (Eq a, Ord a) => a -> a -> Bool T9939.hs:10:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f2 :: (Eq a, Ord a) => a -> a -> Bool + f2 :: forall a. (Eq a, Ord a) => a -> a -> Bool T9939.hs:14:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq b • In the type signature for: - f3 :: (Eq a, a ~ b, Eq b) => a -> b -> Bool + f3 :: forall a b. (Eq a, a ~ b, Eq b) => a -> b -> Bool T9939.hs:21:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f4 :: (Eq a, Eq b) => a -> b -> Equal a b -> Bool + f4 :: forall a b. (Eq a, Eq b) => a -> b -> Equal a b -> Bool diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index 121d95f2d2..d36c58dd11 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -1,12 +1,12 @@ tc168.hs:17:1: error: - • Could not deduce (C a1 (a, b0)) - from the context: C a1 (a, b) + • Could not deduce (C a (a1, b0)) + from the context: C a (a1, b) bound by the inferred type for ‘g’: - C a1 (a, b) => a1 -> a + forall a a1 b. C a (a1, b) => a -> a1 at tc168.hs:17:1-16 The type variable ‘b0’ is ambiguous • In the ambiguity check for the inferred type for ‘g’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - g :: forall b a1 a2. C a2 (a1, b) => a2 -> a1 + g :: forall a1 a2 b. C a1 (a2, b) => a1 -> a2 diff --git a/testsuite/tests/typecheck/should_fail/ClassOperator.stderr b/testsuite/tests/typecheck/should_fail/ClassOperator.stderr index 30791286c2..890783d3c1 100644 --- a/testsuite/tests/typecheck/should_fail/ClassOperator.stderr +++ b/testsuite/tests/typecheck/should_fail/ClassOperator.stderr @@ -3,7 +3,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (**>) :: (a ><> b) => a -> a -> () + (**>) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘**>’ @@ -16,7 +16,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (**<) :: (a ><> b) => a -> a -> () + (**<) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘**<’ @@ -29,7 +29,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (>**) :: (a ><> b) => a -> a -> () + (>**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘>**’ @@ -42,7 +42,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (<**) :: (a ><> b) => a -> a -> () + (<**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘<**’ diff --git a/testsuite/tests/typecheck/should_fail/T10534.stderr b/testsuite/tests/typecheck/should_fail/T10534.stderr index ef42727c9e..86020af877 100644 --- a/testsuite/tests/typecheck/should_fail/T10534.stderr +++ b/testsuite/tests/typecheck/should_fail/T10534.stderr @@ -3,7 +3,7 @@ T10534a.hs:10:9: error: • Could not deduce: Coercible a b arising from a use of ‘coerce’ from the context: Coercible (DF a) (DF b) bound by the type signature for: - silly :: Coercible (DF a) (DF b) => a -> b + silly :: forall a b. Coercible (DF a) (DF b) => a -> b at T10534a.hs:9:1-42 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/typecheck/should_fail/T11947a.stderr b/testsuite/tests/typecheck/should_fail/T11947a.stderr index 4f6a4a7505..9ca1da0ee0 100644 --- a/testsuite/tests/typecheck/should_fail/T11947a.stderr +++ b/testsuite/tests/typecheck/should_fail/T11947a.stderr @@ -3,7 +3,7 @@ T11947a.hs:4:19: error: • Could not deduce (RealFloat a0) from the context: RealFloat a bound by the type signature for: - theFloatDigits :: RealFloat a => Int + theFloatDigits :: forall a. RealFloat a => Int at T11947a.hs:4:19-46 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘theFloatDigits’ diff --git a/testsuite/tests/typecheck/should_fail/T11948.stderr b/testsuite/tests/typecheck/should_fail/T11948.stderr index 4e683f898a..457ac2af4f 100644 --- a/testsuite/tests/typecheck/should_fail/T11948.stderr +++ b/testsuite/tests/typecheck/should_fail/T11948.stderr @@ -3,7 +3,7 @@ T11948.hs:21:18: error: • Could not deduce (Bar (F zq) zq) arising from a use of ‘bar’ from the context: Bar (Foo (F zq)) (Foo zq) bound by the type signature for: - bug :: Bar (Foo (F zq)) (Foo zq) => Foo (F zq) -> Foo zq + bug :: forall zq. Bar (Foo (F zq)) (Foo zq) => Foo (F zq) -> Foo zq at T11948.hs:(19,1)-(20,38) • In the expression: bar sk :: Foo zq In an equation for ‘x’: x = bar sk :: Foo zq diff --git a/testsuite/tests/typecheck/should_fail/T12151.stderr b/testsuite/tests/typecheck/should_fail/T12151.stderr index 17d484e0ea..4b233d8b64 100644 --- a/testsuite/tests/typecheck/should_fail/T12151.stderr +++ b/testsuite/tests/typecheck/should_fail/T12151.stderr @@ -9,7 +9,7 @@ T12151.hs:9:13: error: • Could not deduce (Put a0) from the context: Put a bound by the type signature for: - put :: Put a => t + put :: forall a. Put a => forall t. t at T12151.hs:9:13-15 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘put’ diff --git a/testsuite/tests/typecheck/should_fail/T12918b.stderr b/testsuite/tests/typecheck/should_fail/T12918b.stderr index cc62c75aac..92aa85e9f3 100644 --- a/testsuite/tests/typecheck/should_fail/T12918b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12918b.stderr @@ -17,7 +17,7 @@ T12918b.hs:12:11: error: • Could not deduce (Foo1 a0) from the context: Foo1 a bound by the type signature for: - bar2 :: Foo1 a => x + bar2 :: forall a. Foo1 a => forall x. x at T12918b.hs:12:11-14 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bar2’ diff --git a/testsuite/tests/typecheck/should_fail/T1897a.stderr b/testsuite/tests/typecheck/should_fail/T1897a.stderr index e188a55598..61de72d6a6 100644 --- a/testsuite/tests/typecheck/should_fail/T1897a.stderr +++ b/testsuite/tests/typecheck/should_fail/T1897a.stderr @@ -3,7 +3,7 @@ T1897a.hs:9:1: error: • Could not deduce (Wob a0 b) from the context: Wob a b bound by the inferred type for ‘foo’: - Wob a b => b -> [b] + forall a b. Wob a b => b -> [b] at T1897a.hs:9:1-24 The type variable ‘a0’ is ambiguous • In the ambiguity check for the inferred type for ‘foo’ diff --git a/testsuite/tests/typecheck/should_fail/T2714.stderr b/testsuite/tests/typecheck/should_fail/T2714.stderr index c016586cc4..9b3fc34c52 100644 --- a/testsuite/tests/typecheck/should_fail/T2714.stderr +++ b/testsuite/tests/typecheck/should_fail/T2714.stderr @@ -1,10 +1,10 @@ T2714.hs:8:5: error: - • Couldn't match type ‘a’ with ‘f0 b’ - ‘a’ is a rigid type variable bound by + • Couldn't match type ‘c’ with ‘f0 (a -> b)’ + ‘c’ is a rigid type variable bound by the type signature for: - f :: forall a b. ((a -> b) -> b) -> forall c. c -> a - at T2714.hs:7:1-42 + f :: ((a -> b) -> b) -> forall c. c -> a + at T2714.hs:8:1-9 Expected type: ((a -> b) -> b) -> c -> a Actual type: ((a -> b) -> b) -> f0 (a -> b) -> f0 b • In the expression: ffmap diff --git a/testsuite/tests/typecheck/should_fail/T3592.stderr b/testsuite/tests/typecheck/should_fail/T3592.stderr index 7fe7f6d115..ab03985faa 100644 --- a/testsuite/tests/typecheck/should_fail/T3592.stderr +++ b/testsuite/tests/typecheck/should_fail/T3592.stderr @@ -4,7 +4,7 @@ T3592.hs:8:5: error: Possible fix: add (Show a) to the context of the type signature for: - f :: T a -> String + f :: forall a. T a -> String • In the expression: show In an equation for ‘f’: f = show @@ -13,6 +13,6 @@ T3592.hs:11:7: error: Possible fix: add (Show a) to the context of the type signature for: - g :: T a -> String + g :: forall a. T a -> String • In the expression: show x In an equation for ‘g’: g x = show x diff --git a/testsuite/tests/typecheck/should_fail/T5300.stderr b/testsuite/tests/typecheck/should_fail/T5300.stderr index 589da0a5c4..a80839455e 100644 --- a/testsuite/tests/typecheck/should_fail/T5300.stderr +++ b/testsuite/tests/typecheck/should_fail/T5300.stderr @@ -3,7 +3,9 @@ T5300.hs:11:7: error: • Could not deduce (C1 a b c0) from the context: (Monad m, C1 a b c) bound by the type signature for: - f1 :: (Monad m, C1 a b c) => a -> StateT (T b) m a + f1 :: forall (m :: * -> *) a b c. + (Monad m, C1 a b c) => + a -> StateT (T b) m a at T5300.hs:11:7-50 The type variable ‘c0’ is ambiguous • In the ambiguity check for ‘f1’ @@ -15,7 +17,8 @@ T5300.hs:14:7: error: • Could not deduce (C1 a1 b1 c10) from the context: (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) bound by the type signature for: - f2 :: (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) => + f2 :: forall (m :: * -> *) a1 b1 c1 a2 b2 c2. + (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) => a1 -> StateT (T b2) m a2 at T5300.hs:14:7-69 The type variable ‘c10’ is ambiguous diff --git a/testsuite/tests/typecheck/should_fail/T7279.stderr b/testsuite/tests/typecheck/should_fail/T7279.stderr index 1825bca574..eed8878170 100644 --- a/testsuite/tests/typecheck/should_fail/T7279.stderr +++ b/testsuite/tests/typecheck/should_fail/T7279.stderr @@ -3,7 +3,7 @@ T7279.hs:6:10: error: • Could not deduce (Show b0) from the context: (Eq a, Show b) bound by an instance declaration: - (Eq a, Show b) => Eq (T a) + forall a b. (Eq a, Show b) => Eq (T a) at T7279.hs:6:10-35 The type variable ‘b0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/typecheck/should_fail/T7437.stderr b/testsuite/tests/typecheck/should_fail/T7437.stderr index d305cee426..d6663df40e 100644 --- a/testsuite/tests/typecheck/should_fail/T7437.stderr +++ b/testsuite/tests/typecheck/should_fail/T7437.stderr @@ -11,7 +11,9 @@ T7437.hs:14:13: error: • Could not deduce (Put a0) from the context: (Put a, Generic t, GPut (Rep t)) bound by the type signature for: - put :: (Put a, Generic t, GPut (Rep t)) => t -> [()] + put :: forall a. + Put a => + forall t. (Generic t, GPut (Rep t)) => t -> [()] at T7437.hs:14:13-15 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘put’ diff --git a/testsuite/tests/typecheck/should_fail/T7453.stderr b/testsuite/tests/typecheck/should_fail/T7453.stderr index 9157e116f5..518d6fad05 100644 --- a/testsuite/tests/typecheck/should_fail/T7453.stderr +++ b/testsuite/tests/typecheck/should_fail/T7453.stderr @@ -4,7 +4,7 @@ T7453.hs:9:15: error: because type variable ‘t’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: Id t + z :: forall t. Id t at T7453.hs:8:11-19 Expected type: Id t Actual type: Id p @@ -32,7 +32,7 @@ T7453.hs:15:15: error: because type variable ‘t1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: () -> t1 + z :: forall t1. () -> t1 at T7453.hs:14:11-22 Expected type: () -> t1 Actual type: () -> p @@ -60,7 +60,7 @@ T7453.hs:21:15: error: because type variable ‘t1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: t1 + z :: forall t1. t1 at T7453.hs:20:11-16 • In the expression: v In an equation for ‘z’: diff --git a/testsuite/tests/typecheck/should_fail/T7869.stderr b/testsuite/tests/typecheck/should_fail/T7869.stderr index 00ea8e7438..4cf1cfaf67 100644 --- a/testsuite/tests/typecheck/should_fail/T7869.stderr +++ b/testsuite/tests/typecheck/should_fail/T7869.stderr @@ -4,7 +4,7 @@ T7869.hs:3:12: error: because type variable ‘b1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - [a1] -> b1 + forall a1 b1. [a1] -> b1 at T7869.hs:3:20-27 Expected type: [a1] -> b1 Actual type: [a] -> b diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.stderr b/testsuite/tests/typecheck/should_fail/tcfail032.stderr index d2912b2b94..14be02dc45 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail032.stderr @@ -4,7 +4,7 @@ tcfail032.hs:14:8: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - Eq a1 => a1 -> Int + forall a1. Eq a1 => a1 -> Int at tcfail032.hs:14:13-30 • In the expression: (x :: (Eq a) => a -> Int) In an equation for ‘f’: f x = (x :: (Eq a) => a -> Int) diff --git a/testsuite/tests/typecheck/should_fail/tcfail034.stderr b/testsuite/tests/typecheck/should_fail/tcfail034.stderr index baf68da924..9158fd2014 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail034.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail034.stderr @@ -3,12 +3,12 @@ tcfail034.hs:17:11: error: • Could not deduce (Integral a) arising from a use of ‘mod’ from the context: (Num a, Eq a) bound by the type signature for: - test :: (Num a, Eq a) => a -> Bool + test :: forall a. (Num a, Eq a) => a -> Bool at tcfail034.hs:16:1-32 Possible fix: add (Integral a) to the context of the type signature for: - test :: (Num a, Eq a) => a -> Bool + test :: forall a. (Num a, Eq a) => a -> Bool • In the first argument of ‘(==)’, namely ‘(x `mod` 3)’ In the expression: (x `mod` 3) == 0 In an equation for ‘test’: test x = (x `mod` 3) == 0 diff --git a/testsuite/tests/typecheck/should_fail/tcfail067.stderr b/testsuite/tests/typecheck/should_fail/tcfail067.stderr index df7e0248c9..8ffb02faf0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail067.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail067.stderr @@ -7,7 +7,7 @@ tcfail067.hs:12:16: error: Possible fix: add (Ord a) to the context of the type signature for: - subRangeValue :: SubRange a -> a + subRangeValue :: forall a. SubRange a -> a • In the pattern: SubRange (lower, upper) value In an equation for ‘subRangeValue’: subRangeValue (SubRange (lower, upper) value) = value @@ -17,7 +17,7 @@ tcfail067.hs:15:11: error: Possible fix: add (Ord a) to the context of the type signature for: - subRange :: SubRange a -> (a, a) + subRange :: forall a. SubRange a -> (a, a) • In the pattern: SubRange r value In an equation for ‘subRange’: subRange (SubRange r value) = r @@ -25,12 +25,12 @@ tcfail067.hs:46:12: error: • Could not deduce (Ord a) arising from a use of ‘SubRange’ from the context: Show a bound by the type signature for: - showRange :: Show a => SubRange a -> String + showRange :: forall a. Show a => SubRange a -> String at tcfail067.hs:45:1-43 Possible fix: add (Ord a) to the context of the type signature for: - showRange :: Show a => SubRange a -> String + showRange :: forall a. Show a => SubRange a -> String • In the pattern: SubRange (lower, upper) value In an equation for ‘showRange’: showRange (SubRange (lower, upper) value) @@ -64,13 +64,15 @@ tcfail067.hs:74:5: error: • Could not deduce (Ord a) arising from a use of ‘SubRange’ from the context: Num a bound by the type signature for: - numSubRangeBinOp :: Num a => + numSubRangeBinOp :: forall a. + Num a => (a -> a -> a) -> SubRange a -> SubRange a -> SubRange a at tcfail067.hs:(71,1)-(72,58) Possible fix: add (Ord a) to the context of the type signature for: - numSubRangeBinOp :: Num a => + numSubRangeBinOp :: forall a. + Num a => (a -> a -> a) -> SubRange a -> SubRange a -> SubRange a • In the expression: SubRange (result, result) result In an equation for ‘numSubRangeBinOp’: diff --git a/testsuite/tests/typecheck/should_fail/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr index 1d005be670..15c4556480 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr @@ -3,7 +3,7 @@ tcfail072.hs:23:13: error: • Could not deduce (Ord p0) arising from a use of ‘g’ from the context: (Ord p, Ord q) bound by the type signature for: - g :: (Ord p, Ord q) => AB p q -> Bool + g :: forall p q. (Ord p, Ord q) => AB p q -> Bool at tcfail072.hs:22:1-38 The type variable ‘p0’ is ambiguous These potential instances exist: diff --git a/testsuite/tests/typecheck/should_fail/tcfail080.stderr b/testsuite/tests/typecheck/should_fail/tcfail080.stderr index 68e120232e..2fd7240182 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail080.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail080.stderr @@ -3,7 +3,7 @@ tcfail080.hs:27:1: error: • Could not deduce (Collection c0 a) from the context: Collection c a bound by the inferred type for ‘q’: - Collection c a => a -> Bool + forall (c :: * -> *) a. Collection c a => a -> Bool at tcfail080.hs:27:1-27 The type variable ‘c0’ is ambiguous • In the ambiguity check for the inferred type for ‘q’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail097.stderr b/testsuite/tests/typecheck/should_fail/tcfail097.stderr index f5940edaf2..bc8d9a0cf1 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail097.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail097.stderr @@ -3,10 +3,9 @@ tcfail097.hs:5:6: error: • Could not deduce (Eq a0) from the context: Eq a bound by the type signature for: - f :: Eq a => Int -> Int + f :: forall a. Eq a => Int -> Int at tcfail097.hs:5:6-23 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘f’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - f :: Eq a => Int -> Int + In the type signature: f :: Eq a => Int -> Int diff --git a/testsuite/tests/typecheck/should_fail/tcfail098.stderr b/testsuite/tests/typecheck/should_fail/tcfail098.stderr index bc59975806..503c3e3898 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail098.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail098.stderr @@ -3,7 +3,7 @@ tcfail098.hs:12:10: error: • Could not deduce (Bar a0) from the context: Bar a bound by an instance declaration: - Bar a => Bar Bool + forall a. Bar a => Bar Bool at tcfail098.hs:12:10-26 The type variable ‘a0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/typecheck/should_fail/tcfail102.stderr b/testsuite/tests/typecheck/should_fail/tcfail102.stderr index 7cf8b4fbcb..b7fd16d740 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail102.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail102.stderr @@ -6,7 +6,7 @@ tcfail102.hs:9:15: error: • Could not deduce (Integral (Ratio a)) arising from a use of ‘p’ from the context: Integral a bound by the type signature for: - f :: Integral a => P (Ratio a) -> P (Ratio a) + f :: forall a. Integral a => P (Ratio a) -> P (Ratio a) at tcfail102.hs:8:1-45 • In the ‘p’ field of a record In the expression: x {p = p x} diff --git a/testsuite/tests/typecheck/should_fail/tcfail116.stderr b/testsuite/tests/typecheck/should_fail/tcfail116.stderr index 48976d17ae..952512686e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail116.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail116.stderr @@ -3,7 +3,7 @@ tcfail116.hs:6:5: error: • Could not deduce (Foo a0) from the context: Foo a bound by the type signature for: - bug :: Foo a => () + bug :: forall a. Foo a => () at tcfail116.hs:6:5-13 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bug’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail125.stderr b/testsuite/tests/typecheck/should_fail/tcfail125.stderr index 7946e88932..7fe5275d8f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail125.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail125.stderr @@ -7,6 +7,6 @@ tcfail125.hs:11:4: error: Possible fix: add (Show a) to the context of the type signature for: - f :: Obs a -> String + f :: forall a. Obs a -> String • In the pattern: LiftObs _ _ In an equation for ‘f’: f (LiftObs _ _) = "yes" diff --git a/testsuite/tests/typecheck/should_fail/tcfail142.stderr b/testsuite/tests/typecheck/should_fail/tcfail142.stderr index 3f52ef5f80..ac36ffb5e0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail142.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail142.stderr @@ -3,10 +3,9 @@ tcfail142.hs:18:8: error: • Could not deduce (Bar a0 r) from the context: Bar a r bound by the type signature for: - bar :: Bar a r => r -> () + bar :: forall a r. Bar a r => r -> () at tcfail142.hs:18:8-25 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bar’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - bar :: Bar a r => r -> () + In the type signature: bar :: Bar a r => r -> () diff --git a/testsuite/tests/typecheck/should_fail/tcfail171.stderr b/testsuite/tests/typecheck/should_fail/tcfail171.stderr index 076a3394d4..e5e90903bb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail171.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail171.stderr @@ -4,6 +4,6 @@ tcfail171.hs:9:10: error: Possible fix: add (PrintfArg a) to the context of the type signature for: - phex :: a -> b + phex :: forall a b. a -> b • In the expression: printf "0x%x" x In an equation for ‘phex’: phex x = printf "0x%x" x diff --git a/testsuite/tests/typecheck/should_fail/tcfail198.stderr b/testsuite/tests/typecheck/should_fail/tcfail198.stderr index 373c570863..e8c3852b1c 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail198.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail198.stderr @@ -4,7 +4,7 @@ tcfail198.hs:6:36: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - a1 + forall a1. a1 at tcfail198.hs:6:41 • In the expression: x :: a In the second argument of ‘(++)’, namely ‘[x :: a]’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail208.stderr b/testsuite/tests/typecheck/should_fail/tcfail208.stderr index 45642a7548..d8b48cf2eb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail208.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail208.stderr @@ -3,7 +3,7 @@ tcfail208.hs:4:10: error: • Could not deduce (Eq (m a)) arising from a use of ‘==’ from the context: (Monad m, Eq a) bound by the type signature for: - f :: (Monad m, Eq a) => a -> m a -> Bool + f :: forall (m :: * -> *) a. (Monad m, Eq a) => a -> m a -> Bool at tcfail208.hs:3:1-40 • In the expression: (return x == y) In an equation for ‘f’: f x y = (return x == y) diff --git a/testsuite/tests/warnings/should_compile/PluralS.stderr b/testsuite/tests/warnings/should_compile/PluralS.stderr index 416ebb815b..d03efa5ad6 100644 --- a/testsuite/tests/warnings/should_compile/PluralS.stderr +++ b/testsuite/tests/warnings/should_compile/PluralS.stderr @@ -17,9 +17,11 @@ PluralS.hs:17:24: warning: [-Wtype-defaults (in -Wall)] PluralS.hs:23:1: warning: [-Wredundant-constraints] • Redundant constraint: Num a • In the type signature for: - redundantNum :: (Num a, Num a) => a + redundantNum :: forall a. (Num a, Num a) => a PluralS.hs:26:1: warning: [-Wredundant-constraints] • Redundant constraints: (Show a, Num a, Eq a, Eq a) • In the type signature for: - redundantMultiple :: (Num a, Show a, Num a, Eq a, Eq a) => a + redundantMultiple :: forall a. + (Num a, Show a, Num a, Eq a, Eq a) => + a diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr index b59b49c869..571a24119a 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -5,12 +5,12 @@ WCompatWarningsOn.hs:13:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) (this will become an error in a future GHC release) from the context: Monad m bound by the type signature for: - monadFail :: Monad m => m a + monadFail :: forall (m :: * -> *) a. Monad m => m a at WCompatWarningsOn.hs:11:1-27 Possible fix: add (Control.Monad.Fail.MonadFail m) to the context of the type signature for: - monadFail :: Monad m => m a + monadFail :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just _ <- undefined In the expression: do Just _ <- undefined |