diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-02-03 21:17:11 +0100 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-02-12 23:58:52 +0100 |
commit | df08468113ab46832b7ac0a7311b608d1b418c4d (patch) | |
tree | de3a0ed40b58162976e4831625471b5702b2121f | |
parent | 6c2585e0816cb49487fa6a2be5b8e3f191cf3438 (diff) | |
download | haskell-df08468113ab46832b7ac0a7311b608d1b418c4d.tar.gz |
Always display inferred variables using braces
We now always show "forall {a}. T" for inferred variables,
previously this was controlled by -fprint-explicit-foralls.
This implements part 1 of https://github.com/ghc-proposals/ghc-proposals/pull/179.
Part of GHC ticket #16320.
Furthermore, when printing a levity restriction error, we now display
the HsWrap of the expression. This lets users see the full elaboration with
-fprint-typechecker-elaboration (see also #17670)
93 files changed, 520 insertions, 444 deletions
diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index 22f2b02cd2..6cb8a7bda2 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -758,11 +758,12 @@ positions in the kind of the tycon. mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc mkLHsWrap co_fn (L loc e) = L loc (mkHsWrap co_fn e) --- | Avoid @'HsWrap' co1 ('HsWrap' co2 _)@. +-- | Avoid @'HsWrap' co1 ('HsWrap' co2 _)@ and @'HsWrap' co1 ('HsPar' _ _)@ -- See Note [Detecting forced eta expansion] in "DsExpr" mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc mkHsWrap co_fn e | isIdHsWrapper co_fn = e mkHsWrap co_fn (XExpr (HsWrap co_fn' e)) = mkHsWrap (co_fn <.> co_fn') e +mkHsWrap co_fn (HsPar x (L l e)) = HsPar x (L l (mkHsWrap co_fn e)) mkHsWrap co_fn e = XExpr (HsWrap co_fn e) mkHsWrapCo :: TcCoercionN -- A Nominal coercion a ~N b diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs index 184849d319..f879013283 100644 --- a/compiler/GHC/Iface/Type.hs +++ b/compiler/GHC/Iface/Type.hs @@ -1102,10 +1102,7 @@ pprIfaceForAllBndr :: IfaceForAllBndr -> SDoc pprIfaceForAllBndr bndr = case bndr of Bndr (IfaceTvBndr tv) Inferred -> - sdocWithDynFlags $ \dflags -> - if gopt Opt_PrintExplicitForalls dflags - then braces $ pprIfaceTvBndr tv suppress_sig (UseBndrParens False) - else pprIfaceTvBndr tv suppress_sig (UseBndrParens True) + braces $ pprIfaceTvBndr tv suppress_sig (UseBndrParens False) Bndr (IfaceTvBndr tv) _ -> pprIfaceTvBndr tv suppress_sig (UseBndrParens True) Bndr (IfaceIdBndr idv) _ -> pprIfaceIdBndr idv diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index a6547f1f8d..23d53ce3ca 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -257,64 +257,65 @@ dsLExprNoLP (L loc e) ; return e' } dsExpr :: HsExpr GhcTc -> DsM CoreExpr -dsExpr = ds_expr False - -ds_expr :: Bool -- are we directly inside an HsWrap? - -- See Wrinkle in Note [Detecting forced eta expansion] - -> HsExpr GhcTc -> DsM CoreExpr -ds_expr _ (HsPar _ e) = dsLExpr e -ds_expr _ (ExprWithTySig _ e _) = dsLExpr e -ds_expr w (HsVar _ (L _ var)) = dsHsVar w var -ds_expr _ (HsUnboundVar {}) = panic "dsExpr: HsUnboundVar" -- Typechecker eliminates them -ds_expr w (HsConLikeOut _ con) = dsConLike w con -ds_expr _ (HsIPVar {}) = panic "dsExpr: HsIPVar" -ds_expr _ (HsOverLabel{}) = panic "dsExpr: HsOverLabel" - -ds_expr _ (HsLit _ lit) +dsExpr (HsPar _ e) = dsLExpr e +dsExpr (ExprWithTySig _ e _) = dsLExpr e +dsExpr (HsVar _ (L _ var)) = dsHsVar var +dsExpr (HsUnboundVar {}) = panic "dsExpr: HsUnboundVar" -- Typechecker eliminates them +dsExpr (HsConLikeOut _ con) = dsConLike con +dsExpr (HsIPVar {}) = panic "dsExpr: HsIPVar" +dsExpr (HsOverLabel{}) = panic "dsExpr: HsOverLabel" + +dsExpr (HsLit _ lit) = do { warnAboutOverflowedLit lit ; dsLit (convertLit lit) } -ds_expr _ (HsOverLit _ lit) +dsExpr (HsOverLit _ lit) = do { warnAboutOverflowedOverLit lit ; dsOverLit lit } -ds_expr _ (XExpr (HsWrap co_fn e)) - = do { e' <- ds_expr True e -- This is the one place where we recurse to - -- ds_expr (passing True), rather than dsExpr +dsExpr hswrap@(XExpr (HsWrap co_fn e)) + = do { e' <- case e of + HsVar _ (L _ var) -> return $ varToCoreExpr var + HsConLikeOut _ (RealDataCon dc) -> return $ varToCoreExpr (dataConWrapId dc) + XExpr (HsWrap _ _) -> pprPanic "dsExpr: HsWrap inside HsWrap" (ppr hswrap) + HsPar _ _ -> pprPanic "dsExpr: HsPar inside HsWrap" (ppr hswrap) + _ -> dsExpr e + -- See Note [Detecting forced eta expansion] ; wrap' <- dsHsWrapper co_fn ; dflags <- getDynFlags ; let wrapped_e = wrap' e' wrapped_ty = exprType wrapped_e - ; checkForcedEtaExpansion e wrapped_ty -- See Note [Detecting forced eta expansion] + ; checkForcedEtaExpansion e (ppr hswrap) wrapped_ty -- See Note [Detecting forced eta expansion] + -- Pass HsWrap, so that the user can see entire expression with -fprint-typechecker-elaboration ; warnAboutIdentities dflags e' wrapped_ty ; return wrapped_e } -ds_expr _ (NegApp _ (L loc - (HsOverLit _ lit@(OverLit { ol_val = HsIntegral i}))) - neg_expr) +dsExpr (NegApp _ (L loc + (HsOverLit _ lit@(OverLit { ol_val = HsIntegral i}))) + neg_expr) = do { expr' <- putSrcSpanDs loc $ do { warnAboutOverflowedOverLit (lit { ol_val = HsIntegral (negateIntegralLit i) }) ; dsOverLit lit } ; dsSyntaxExpr neg_expr [expr'] } -ds_expr _ (NegApp _ expr neg_expr) +dsExpr (NegApp _ expr neg_expr) = do { expr' <- dsLExpr expr ; dsSyntaxExpr neg_expr [expr'] } -ds_expr _ (HsLam _ a_Match) +dsExpr (HsLam _ a_Match) = uncurry mkLams <$> matchWrapper LambdaExpr Nothing a_Match -ds_expr _ (HsLamCase _ matches) +dsExpr (HsLamCase _ matches) = do { ([discrim_var], matching_code) <- matchWrapper CaseAlt Nothing matches ; return $ Lam discrim_var matching_code } -ds_expr _ e@(HsApp _ fun arg) +dsExpr e@(HsApp _ fun arg) = do { fun' <- dsLExpr fun ; dsWhenNoErrs (dsLExprNoLP arg) (\arg' -> mkCoreAppDs (text "HsApp" <+> ppr e) fun' arg') } -ds_expr _ (HsAppType _ e _) +dsExpr (HsAppType _ e _) -- ignore type arguments here; they're in the wrappers instead at this point = dsLExpr e @@ -357,19 +358,19 @@ If \tr{expr} is actually just a variable, say, then the simplifier will sort it out. -} -ds_expr _ e@(OpApp _ e1 op e2) +dsExpr e@(OpApp _ e1 op e2) = -- for the type of y, we need the type of op's 2nd argument do { op' <- dsLExpr op ; dsWhenNoErrs (mapM dsLExprNoLP [e1, e2]) (\exprs' -> mkCoreAppsDs (text "opapp" <+> ppr e) op' exprs') } -ds_expr _ (SectionL _ expr op) -- Desugar (e !) to ((!) e) +dsExpr (SectionL _ expr op) -- Desugar (e !) to ((!) e) = do { op' <- dsLExpr op ; dsWhenNoErrs (dsLExprNoLP expr) (\expr' -> mkCoreAppDs (text "sectionl" <+> ppr expr) op' expr') } -- dsLExpr (SectionR op expr) -- \ x -> op x expr -ds_expr _ e@(SectionR _ op expr) = do +dsExpr e@(SectionR _ op expr) = do core_op <- dsLExpr op -- for the type of x, we need the type of op's 2nd argument let (x_ty:y_ty:_, _) = splitFunTys (exprType core_op) @@ -380,7 +381,7 @@ ds_expr _ e@(SectionR _ op expr) = do Lam x_id (mkCoreAppsDs (text "sectionr" <+> ppr e) core_op [Var x_id, Var y_id])) -ds_expr _ (ExplicitTuple _ tup_args boxity) +dsExpr (ExplicitTuple _ tup_args boxity) = do { let go (lam_vars, args) (L _ (Missing ty)) -- For every missing expression, we need -- another lambda in the desugaring. @@ -391,7 +392,7 @@ ds_expr _ (ExplicitTuple _ tup_args boxity) -- lambdas, just arguments. = do { core_expr <- dsLExprNoLP expr ; return (lam_vars, core_expr : args) } - go _ _ = panic "ds_expr" + go _ _ = panic "dsExpr" ; dsWhenNoErrs (foldM go ([], []) (reverse tup_args)) -- The reverse is because foldM goes left-to-right @@ -399,37 +400,37 @@ ds_expr _ (ExplicitTuple _ tup_args boxity) mkCoreTupBoxity boxity args) } -- See Note [Don't flatten tuples from HsSyn] in MkCore -ds_expr _ (ExplicitSum types alt arity expr) +dsExpr (ExplicitSum types alt arity expr) = do { dsWhenNoErrs (dsLExprNoLP expr) (\core_expr -> mkCoreConApps (sumDataCon alt arity) (map (Type . getRuntimeRep) types ++ map Type types ++ [core_expr]) ) } -ds_expr _ (HsPragE _ prag expr) = +dsExpr (HsPragE _ prag expr) = ds_prag_expr prag expr -ds_expr _ (HsCase _ discrim matches) +dsExpr (HsCase _ discrim matches) = do { core_discrim <- dsLExpr discrim ; ([discrim_var], matching_code) <- matchWrapper CaseAlt (Just discrim) matches ; return (bindNonRec discrim_var core_discrim matching_code) } -- Pepe: The binds are in scope in the body but NOT in the binding group -- This is to avoid silliness in breakpoints -ds_expr _ (HsLet _ binds body) = do +dsExpr (HsLet _ binds body) = do body' <- dsLExpr body dsLocalBinds binds body' -- We need the `ListComp' form to use `deListComp' (rather than the "do" form) -- because the interpretation of `stmts' depends on what sort of thing it is. -- -ds_expr _ (HsDo res_ty ListComp (L _ stmts)) = dsListComp stmts res_ty -ds_expr _ (HsDo _ DoExpr (L _ stmts)) = dsDo stmts -ds_expr _ (HsDo _ GhciStmtCtxt (L _ stmts)) = dsDo stmts -ds_expr _ (HsDo _ MDoExpr (L _ stmts)) = dsDo stmts -ds_expr _ (HsDo _ MonadComp (L _ stmts)) = dsMonadComp stmts +dsExpr (HsDo res_ty ListComp (L _ stmts)) = dsListComp stmts res_ty +dsExpr (HsDo _ DoExpr (L _ stmts)) = dsDo stmts +dsExpr (HsDo _ GhciStmtCtxt (L _ stmts)) = dsDo stmts +dsExpr (HsDo _ MDoExpr (L _ stmts)) = dsDo stmts +dsExpr (HsDo _ MonadComp (L _ stmts)) = dsMonadComp stmts -ds_expr _ (HsIf _ fun guard_expr then_expr else_expr) +dsExpr (HsIf _ fun guard_expr then_expr else_expr) = do { pred <- dsLExpr guard_expr ; b1 <- dsLExpr then_expr ; b2 <- dsLExpr else_expr @@ -437,7 +438,7 @@ ds_expr _ (HsIf _ fun guard_expr then_expr else_expr) (SyntaxExprTc {}) -> dsSyntaxExpr fun [pred, b1, b2] NoSyntaxExprTc -> return $ mkIfThenElse pred b1 b2 } -ds_expr _ (HsMultiIf res_ty alts) +dsExpr (HsMultiIf res_ty alts) | null alts = mkErrorExpr @@ -457,10 +458,10 @@ ds_expr _ (HsMultiIf res_ty alts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} -ds_expr _ (ExplicitList elt_ty wit xs) +dsExpr (ExplicitList elt_ty wit xs) = dsExplicitList elt_ty wit xs -ds_expr _ (ArithSeq expr witness seq) +dsExpr (ArithSeq expr witness seq) = case witness of Nothing -> dsArithSeq expr seq Just fl -> do { newArithSeq <- dsArithSeq expr seq @@ -477,7 +478,7 @@ See Note [Grand plan for static forms] in StaticPtrTable for an overview. g = ... makeStatic loc f ... -} -ds_expr _ (HsStatic _ expr@(L loc _)) = do +dsExpr (HsStatic _ expr@(L loc _)) = do expr_ds <- dsLExprNoLP expr let ty = exprType expr_ds makeStaticId <- dsLookupGlobalId makeStaticName @@ -519,9 +520,9 @@ We also handle @C{}@ as valid construction syntax for an unlabelled constructor @C@, setting all of @C@'s fields to bottom. -} -ds_expr _ (RecordCon { rcon_flds = rbinds - , rcon_ext = RecordConTc { rcon_con_expr = con_expr - , rcon_con_like = con_like }}) +dsExpr (RecordCon { rcon_flds = rbinds + , rcon_ext = RecordConTc { rcon_con_expr = con_expr + , rcon_con_like = con_like }}) = do { con_expr' <- dsExpr con_expr ; let (arg_tys, _) = tcSplitFunTys (exprType con_expr') @@ -579,12 +580,12 @@ So we need to cast (T a Int) to (T a b). Sigh. -} -ds_expr _ expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = fields - , rupd_ext = RecordUpdTc - { rupd_cons = cons_to_upd - , rupd_in_tys = in_inst_tys - , rupd_out_tys = out_inst_tys - , rupd_wrap = dict_req_wrap }} ) +dsExpr expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = fields + , rupd_ext = RecordUpdTc + { rupd_cons = cons_to_upd + , rupd_in_tys = in_inst_tys + , rupd_out_tys = out_inst_tys + , rupd_wrap = dict_req_wrap }} ) | null fields = dsLExpr record_expr | otherwise @@ -729,16 +730,16 @@ Thus, we pass @r@ as the scrutinee expression to @matchWrapper@ above. -- Template Haskell stuff -ds_expr _ (HsRnBracketOut _ _ _) = panic "dsExpr HsRnBracketOut" -ds_expr _ (HsTcBracketOut _ hs_wrapper x ps) = dsBracket hs_wrapper x ps -ds_expr _ (HsSpliceE _ s) = pprPanic "dsExpr:splice" (ppr s) +dsExpr (HsRnBracketOut _ _ _) = panic "dsExpr HsRnBracketOut" +dsExpr (HsTcBracketOut _ hs_wrapper x ps) = dsBracket hs_wrapper x ps +dsExpr (HsSpliceE _ s) = pprPanic "dsExpr:splice" (ppr s) -- Arrow notation extension -ds_expr _ (HsProc _ pat cmd) = dsProcExpr pat cmd +dsExpr (HsProc _ pat cmd) = dsProcExpr pat cmd -- Hpc Support -ds_expr _ (HsTick _ tickish e) = do +dsExpr (HsTick _ tickish e) = do e' <- dsLExpr e return (Tick tickish e') @@ -749,16 +750,16 @@ ds_expr _ (HsTick _ tickish e) = do -- (did you go here: YES or NO), but will effect accurate -- tick counting. -ds_expr _ (HsBinTick _ ixT ixF e) = do +dsExpr (HsBinTick _ ixT ixF e) = do e2 <- dsLExpr e do { ASSERT(exprType e2 `eqType` boolTy) mkBinaryTickBox ixT ixF e2 } -- HsSyn constructs that just shouldn't be here: -ds_expr _ (HsBracket {}) = panic "dsExpr:HsBracket" -ds_expr _ (HsDo {}) = panic "dsExpr:HsDo" -ds_expr _ (HsRecFld {}) = panic "dsExpr:HsRecFld" +dsExpr (HsBracket {}) = panic "dsExpr:HsBracket" +dsExpr (HsDo {}) = panic "dsExpr:HsDo" +dsExpr (HsRecFld {}) = panic "dsExpr:HsRecFld" ds_prag_expr :: HsPragE GhcTc -> LHsExpr GhcTc -> DsM CoreExpr ds_prag_expr (HsPragSCC _ _ cc) expr = do @@ -1036,26 +1037,18 @@ mk_fail_msg dflags pat = "Pattern match failure in do expression at " ++ ************************************************************************ -} -dsHsVar :: Bool -- are we directly inside an HsWrap? - -- See Wrinkle in Note [Detecting forced eta expansion] - -> Id -> DsM CoreExpr -dsHsVar w var - | not w - , let bad_tys = badUseOfLevPolyPrimop var ty - , not (null bad_tys) - = do { levPolyPrimopErr var ty bad_tys - ; return unitExpr } -- return something eminently safe - - | otherwise - = return (varToCoreExpr var) -- See Note [Desugaring vars] +dsHsVar :: Id -> DsM CoreExpr +dsHsVar var + -- See Wrinkle in Note [Detecting forced eta expansion] + = ASSERT2(null (badUseOfLevPolyPrimop var ty), ppr var $$ ppr ty) + return (varToCoreExpr var) -- See Note [Desugaring vars] where ty = idType var -dsConLike :: Bool -- as in dsHsVar - -> ConLike -> DsM CoreExpr -dsConLike w (RealDataCon dc) = dsHsVar w (dataConWrapId dc) -dsConLike _ (PatSynCon ps) = return $ case patSynBuilder ps of +dsConLike :: ConLike -> DsM CoreExpr +dsConLike (RealDataCon dc) = dsHsVar (dataConWrapId dc) +dsConLike (PatSynCon ps) = return $ case patSynBuilder ps of Just (id, add_void) | add_void -> mkCoreApp (text "dsConLike" <+> ppr ps) (Var id) (Var voidPrimId) | otherwise -> Var id @@ -1131,7 +1124,8 @@ polymorphic. So the right spot seems to be to look after the Id has been applied to its type arguments. To make the algorithm efficient, it's important to be able to spot ((#,#) @a @b @c @d) without looking past all the type arguments. We thus require that - * The body of an HsWrap is not an HsWrap. + * The body of an HsWrap is not an HsWrap, nor an HsPar. +This invariant is checked in dsExpr. With that representation invariant, we simply look inside every HsWrap to see if its body is an HsVar whose Id hasNoBinding. Then, we look at the wrapped type. If it has any levity polymorphic arguments, reject. @@ -1147,30 +1141,33 @@ So, either way, we're good to reject. Wrinkle ~~~~~~~ -Not all polymorphic Ids are wrapped in -HsWrap, due to the lazy instantiation of TypeApplications. (See "Visible type -application", ESOP '16.) But if we spot a levity-polymorphic hasNoBinding Id -without a wrapper, then that is surely problem and we can reject. - -We thus have a parameter to `dsExpr` that tracks whether or not we are -directly in an HsWrap. If we find a levity-polymorphic hasNoBinding Id when -we're not directly in an HsWrap, reject. - +Currently, all levity-polymorphic Ids are wrapped in HsWrap. + +However, this is not set in stone, in the future we might make +instantiation more lazy. (See "Visible type application", ESOP '16.) +If we spot a levity-polymorphic hasNoBinding Id without a wrapper, +then that is surely a problem. In this case, we raise an assertion failure. +This failure can be changed to a call to `levPolyPrimopErr` in the future, +if we decide to change instantiation. + +We can just check HsVar and HsConLikeOut for RealDataCon, since +we don't have levity-polymorphic pattern synonyms. (This might change +in the future.) -} -- | Takes an expression and its instantiated type. If the expression is an -- HsVar with a hasNoBinding primop and the type has levity-polymorphic arguments, -- issue an error. See Note [Detecting forced eta expansion] -checkForcedEtaExpansion :: HsExpr GhcTc -> Type -> DsM () -checkForcedEtaExpansion expr ty +checkForcedEtaExpansion :: HsExpr GhcTc -> SDoc -> Type -> DsM () +checkForcedEtaExpansion expr expr_doc ty | Just var <- case expr of HsVar _ (L _ var) -> Just var HsConLikeOut _ (RealDataCon dc) -> Just (dataConWrapId dc) _ -> Nothing , let bad_tys = badUseOfLevPolyPrimop var ty , not (null bad_tys) - = levPolyPrimopErr var ty bad_tys -checkForcedEtaExpansion _ _ = return () + = levPolyPrimopErr expr_doc ty bad_tys +checkForcedEtaExpansion _ _ _ = return () -- | Is this a hasNoBinding Id with a levity-polymorphic type? -- Returns the arguments that are levity polymorphic if they are bad; @@ -1186,11 +1183,17 @@ badUseOfLevPolyPrimop id ty (binders, _) = splitPiTys ty arg_tys = mapMaybe binderRelevantType_maybe binders -levPolyPrimopErr :: Id -> Type -> [Type] -> DsM () -levPolyPrimopErr primop ty bad_tys +levPolyPrimopErr :: SDoc -> Type -> [Type] -> DsM () +levPolyPrimopErr expr_doc ty bad_tys = errDs $ vcat [ hang (text "Cannot use function with levity-polymorphic arguments:") - 2 (ppr primop <+> dcolon <+> pprWithTYPE ty) + 2 (expr_doc <+> dcolon <+> pprWithTYPE ty) + , sdocWithDynFlags $ \dflags -> + if not (gopt Opt_PrintTypecheckerElaboration dflags) then vcat + [ text "(Note that levity-polymorphic primops such as 'coerce' and unboxed tuples" + , text "are eta-expanded internally because they must occur fully saturated." + , text "Use -fprint-typechecker-elaboration to display the full expression.)" + ] else empty , hang (text "Levity-polymorphic arguments:") 2 $ vcat $ map (\t -> pprWithTYPE t <+> dcolon <+> pprWithTYPE (typeKind t)) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 23571d3cb2..1d81788f0b 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -815,10 +815,8 @@ See also Note [Required, Specified, and Inferred for types] in TcTyClsDecls Specified: a list of Specified binders is written between `forall` and `.`: const :: forall a b. a -> b -> a - Inferred: with -fprint-explicit-foralls, Inferred binders are written - in braces: + Inferred: like Specified, but every binder is written in braces: f :: forall {k} (a:k). S k a -> Int - Otherwise, they are printed like Specified binders. Required: binders are put between `forall` and `->`: T :: forall k -> * diff --git a/docs/users_guide/exts/poly_kinds.rst b/docs/users_guide/exts/poly_kinds.rst index 96a0a92f34..b41176a6c8 100644 --- a/docs/users_guide/exts/poly_kinds.rst +++ b/docs/users_guide/exts/poly_kinds.rst @@ -152,8 +152,7 @@ Note that ``k2`` is placed *before* ``k``, and that ``k`` is placed *before* type and kind variables that GHC generalises over, but not written in the original program, are not available for visible type application. (These are called *inferred* variables.) -Such variables are written in braces with -:ghc-flag:`-fprint-explicit-foralls` enabled. +Such variables are written in braces. The general principle is this: diff --git a/docs/users_guide/exts/type_applications.rst b/docs/users_guide/exts/type_applications.rst index 2e789c99e3..2a735436d8 100644 --- a/docs/users_guide/exts/type_applications.rst +++ b/docs/users_guide/exts/type_applications.rst @@ -73,9 +73,9 @@ Because ``k`` was not written by the user, it will be unavailable for type application in the type of the constructor ``Proxy``; only the ``a`` will be available. -When :ghc-flag:`-fprint-explicit-foralls` is enabled, inferred variables -are printed in braces. Thus, the type of the data constructor ``Proxy`` -from the previous example would be ``forall {k} (a :: k). Proxy a``. +Inferred variables are printed in braces. Thus, the type of the data +constructor ``Proxy`` from the previous example is +``forall {k} (a :: k). Proxy a``. We can observe this behavior in a GHCi session: :: > :set -XTypeApplications -fprint-explicit-foralls diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst index 8d4bb64330..86094cc9cc 100644 --- a/docs/users_guide/using.rst +++ b/docs/users_guide/using.rst @@ -771,9 +771,6 @@ messages and in GHCi: (a Data.Type.Equality.:~: b) -> b Data.Type.Equality.:~: a -- Defined in Data.Type.Equality - This flag also enables the printing of *inferred* type variables - inside braces. See :ref:`inferred-vs-specified`. - .. ghc-flag:: -fprint-explicit-kinds :shortdesc: Print explicit kind foralls and kind arguments in types. See also :extension:`KindSignatures` diff --git a/testsuite/tests/ado/ado004.stderr b/testsuite/tests/ado/ado004.stderr index f2fe23360c..47024fdfd1 100644 --- a/testsuite/tests/ado/ado004.stderr +++ b/testsuite/tests/ado/ado004.stderr @@ -8,37 +8,37 @@ TYPE SIGNATURES test1c :: forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int test2 :: - forall (f :: * -> *) t b. + forall {f :: * -> *} {t} {b}. (Applicative f, Num t, Num b) => (t -> f b) -> f b test2a :: - forall (f :: * -> *) t b. + forall {f :: * -> *} {t} {b}. (Functor f, Num t, Num b) => (t -> f b) -> f b test2b :: - forall (m :: * -> *) t a. (Monad m, Num t) => (t -> a) -> m a + forall {m :: * -> *} {t} {a}. (Monad m, Num t) => (t -> a) -> m a test2c :: - forall (f :: * -> *) t b. + forall {f :: * -> *} {t} {b}. (Functor f, Num t, Num b) => (t -> f b) -> f b test2d :: - forall (f :: * -> *) t1 b t2. + forall {f :: * -> *} {t1} {b} {t2}. (Functor f, Num t1, Num b) => (t1 -> f t2) -> f b test3 :: - forall (m :: * -> *) t1 t2 a. + forall {m :: * -> *} {t1} {t2} {a}. (Monad m, Num t1) => (t1 -> m t2) -> (t2 -> t2 -> m a) -> m a test4 :: - forall (m :: * -> *) t a1 a2. + forall {m :: * -> *} {t} {a1} {a2}. (Monad m, Num t) => (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test5 :: - forall (m :: * -> *) t a1 a2. + forall {m :: * -> *} {t} {a1} {a2}. (Monad m, Num t) => (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test6 :: - forall (m :: * -> *) a p. + forall {m :: * -> *} {a} {p}. (Monad m, Num (m a)) => (m a -> m (m a)) -> p -> m a Dependent modules: [] diff --git a/testsuite/tests/codeGen/should_fail/T13233.stderr b/testsuite/tests/codeGen/should_fail/T13233.stderr index 08f1f62a88..a3d77d0b73 100644 --- a/testsuite/tests/codeGen/should_fail/T13233.stderr +++ b/testsuite/tests/codeGen/should_fail/T13233.stderr @@ -1,16 +1,22 @@ T13233.hs:14:11: error: Cannot use function with levity-polymorphic arguments: - GHC.Prim.(#,#) :: a -> a -> (# a, a #) + (#,#) :: a -> a -> (# a, a #) + (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples + are eta-expanded internally because they must occur fully saturated. + Use -fprint-typechecker-elaboration to display the full expression.) Levity-polymorphic arguments: a :: TYPE rep a :: TYPE rep T13233.hs:22:16: error: Cannot use function with levity-polymorphic arguments: - GHC.Prim.(#,#) :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep) - (a :: TYPE rep1) (b :: TYPE rep2). - a -> b -> (# a, b #) + (#,#) :: forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep} + {a :: TYPE rep1} {b :: TYPE rep2}. + a -> b -> (# a, b #) + (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples + are eta-expanded internally because they must occur fully saturated. + Use -fprint-typechecker-elaboration to display the full expression.) Levity-polymorphic arguments: a :: TYPE rep1 b :: TYPE rep2 diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.hs b/testsuite/tests/codeGen/should_fail/T13233_elab.hs new file mode 100644 index 0000000000..87269769d9 --- /dev/null +++ b/testsuite/tests/codeGen/should_fail/T13233_elab.hs @@ -0,0 +1,33 @@ +-- Same as T13233, but we compile with -fprint-typechecker-elaboration. +-- The error message should show an eta-expanded call to (#,#). +-- See comments at https://gitlab.haskell.org/ghc/ghc/merge_requests/2540 +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE MagicHash #-} +module Bug where + +import GHC.Exts (TYPE, RuntimeRep, Weak#, State#, RealWorld, mkWeak# ) + +class Foo (a :: TYPE rep) where + bar :: forall rep2 (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + +baz :: forall rep (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz = bar (#,#) + +obscure :: (forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep) + (a :: TYPE rep1) (b :: TYPE rep2). + a -> b -> (# a, b #)) -> () +obscure _ = () + +quux :: () +quux = obscure (#,#) + +-- It used to be that primops has no binding. However, as described in +-- Note [Primop wrappers] in PrimOp we now rewrite unsaturated primop +-- applications to their wrapper, which allows safe use of levity polymorphism. +primop :: forall (rep :: RuntimeRep) (a :: TYPE rep) b c. + a -> b -> (State# RealWorld -> (# State# RealWorld, c #)) + -> State# RealWorld -> (# State# RealWorld, Weak# b #) +primop = mkWeak# diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr new file mode 100644 index 0000000000..214e982222 --- /dev/null +++ b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr @@ -0,0 +1,20 @@ + +T13233_elab.hs:17:11: error: + Cannot use function with levity-polymorphic arguments: + (#,#) @rep @rep @a @a :: a -> a -> (# a, a #) + Levity-polymorphic arguments: + a :: TYPE rep + a :: TYPE rep + +T13233_elab.hs:25:16: error: + Cannot use function with levity-polymorphic arguments: + /\(@(rep1 :: RuntimeRep)). + /\(@(rep2 :: RuntimeRep)). + /\(@(a :: TYPE rep1)). + /\(@(b :: TYPE rep2)). + (#,#) @rep1 @rep2 @a @b :: forall {rep1 :: RuntimeRep} + {rep2 :: RuntimeRep} {a :: TYPE rep1} {b :: TYPE rep2}. + a -> b -> (# a, b #) + Levity-polymorphic arguments: + a :: TYPE rep1 + b :: TYPE rep2 diff --git a/testsuite/tests/codeGen/should_fail/all.T b/testsuite/tests/codeGen/should_fail/all.T index 1fe2141caf..aae2dcee31 100644 --- a/testsuite/tests/codeGen/should_fail/all.T +++ b/testsuite/tests/codeGen/should_fail/all.T @@ -4,3 +4,4 @@ # memcpy operations test('T8131', [cmm_src, only_ways(llvm_ways)], compile_fail, ['']) test('T13233', normal, compile_fail, ['']) +test('T13233_elab', normal, compile_fail, ['-fprint-typechecker-elaboration']) diff --git a/testsuite/tests/dependent/should_compile/T14066a.stderr b/testsuite/tests/dependent/should_compile/T14066a.stderr index 906695f3f7..e3ee00fcea 100644 --- a/testsuite/tests/dependent/should_compile/T14066a.stderr +++ b/testsuite/tests/dependent/should_compile/T14066a.stderr @@ -1,5 +1,5 @@ T14066a.hs:13:3: warning: Type family instance equation is overlapped: - forall c d (x :: c) (y :: d). + forall {c} {d} {x :: c} {y :: d}. Bar x y = Bool -- Defined at T14066a.hs:13:3 diff --git a/testsuite/tests/dependent/should_compile/T14729.stderr b/testsuite/tests/dependent/should_compile/T14729.stderr index 53f3862f87..74f04b591f 100644 --- a/testsuite/tests/dependent/should_compile/T14729.stderr +++ b/testsuite/tests/dependent/should_compile/T14729.stderr @@ -1,6 +1,6 @@ TYPE SIGNATURES x :: forall (x :: Bool). P (F Int) (x |> Sym (T14729.D:R:FInt[0])) - y :: forall (x :: Bool). P Bool x + y :: forall {x :: Bool}. P Bool x TYPE CONSTRUCTORS type family F{1} :: * -> * roles nominal diff --git a/testsuite/tests/dependent/should_fail/BadTelescope4.stderr b/testsuite/tests/dependent/should_fail/BadTelescope4.stderr index 039389bed0..3ffec6407f 100644 --- a/testsuite/tests/dependent/should_fail/BadTelescope4.stderr +++ b/testsuite/tests/dependent/should_fail/BadTelescope4.stderr @@ -1,7 +1,7 @@ BadTelescope4.hs:9:1: error: • The kind of ‘Bad’ is ill-scoped - Inferred kind: Bad :: forall k (b :: Proxy a). forall (a :: k) -> + Inferred kind: Bad :: forall {k} (b :: Proxy a). forall (a :: k) -> Proxy b -> forall (d :: Proxy a) -> SameKind b d -> * NB: Inferred variables (namely: k) always come first diff --git a/testsuite/tests/dependent/should_fail/T14066d.stderr b/testsuite/tests/dependent/should_fail/T14066d.stderr index 23b8577a1b..289c7a121a 100644 --- a/testsuite/tests/dependent/should_fail/T14066d.stderr +++ b/testsuite/tests/dependent/should_fail/T14066d.stderr @@ -15,7 +15,7 @@ T14066d.hs:11:35: error: In the expression: g y In the expression: (fstOf3 y :: Proxy Maybe, g y) • Relevant bindings include - y :: forall k1 k2 (a :: k1) (c :: k2). (Proxy a, Proxy c, b) + y :: forall {k1} {k2} (a :: k1) (c :: k2). (Proxy a, Proxy c, b) (bound at T14066d.hs:15:5) x :: b (bound at T14066d.hs:11:3) f :: b -> (Proxy Maybe, ()) (bound at T14066d.hs:11:1) diff --git a/testsuite/tests/dependent/should_fail/T14066e.stderr b/testsuite/tests/dependent/should_fail/T14066e.stderr index 7216bc7b19..03a2b9255d 100644 --- a/testsuite/tests/dependent/should_fail/T14066e.stderr +++ b/testsuite/tests/dependent/should_fail/T14066e.stderr @@ -3,7 +3,7 @@ T14066e.hs:13:59: error: • Couldn't match kind ‘k’ with ‘*’ ‘k’ is a rigid type variable bound by the type signature for: - j :: forall k k1 (c :: k) (b :: k1). + j :: forall {k} {k1} (c :: k) (b :: k1). Proxy a -> Proxy b -> Proxy c -> Proxy b at T14066e.hs:12:5-61 When matching kinds diff --git a/testsuite/tests/dependent/should_fail/T15591b.stderr b/testsuite/tests/dependent/should_fail/T15591b.stderr index 91d9a948f4..403a871b55 100644 --- a/testsuite/tests/dependent/should_fail/T15591b.stderr +++ b/testsuite/tests/dependent/should_fail/T15591b.stderr @@ -1,7 +1,7 @@ T15591b.hs:9:3: error: • The kind of ‘T4’ is ill-scoped - Inferred kind: T4 :: forall (b :: Proxy a). forall a -> + Inferred kind: T4 :: forall {b :: Proxy a}. forall a -> Proxy b -> * NB: Inferred variables (namely: (b :: Proxy a)) always come first Perhaps try this order instead: a (b :: Proxy a) (c :: Proxy b) diff --git a/testsuite/tests/dependent/should_fail/T15591c.stderr b/testsuite/tests/dependent/should_fail/T15591c.stderr index ecaa66048c..242ec3e4cc 100644 --- a/testsuite/tests/dependent/should_fail/T15591c.stderr +++ b/testsuite/tests/dependent/should_fail/T15591c.stderr @@ -1,7 +1,7 @@ T15591c.hs:9:3: error: • The kind of ‘T5’ is ill-scoped - Inferred kind: T5 :: forall (b :: Proxy a). + Inferred kind: T5 :: forall {b :: Proxy a}. Proxy b -> forall a -> * NB: Inferred variables (namely: (b :: Proxy a)) always come first Perhaps try this order instead: a (b :: Proxy a) (c :: Proxy b) diff --git a/testsuite/tests/dependent/should_fail/T15743c.stderr b/testsuite/tests/dependent/should_fail/T15743c.stderr index 4cb1c0c959..1e7a46c2ab 100644 --- a/testsuite/tests/dependent/should_fail/T15743c.stderr +++ b/testsuite/tests/dependent/should_fail/T15743c.stderr @@ -1,7 +1,7 @@ T15743c.hs:10:1: error: • The kind of ‘T’ is ill-scoped - Inferred kind: T :: forall (d :: k). + Inferred kind: T :: forall {d :: k}. forall k (c :: k) (a :: Proxy c) (b :: Proxy d) -> SimilarKind a b -> * NB: Inferred variables (namely: (d :: k)) always come first diff --git a/testsuite/tests/determinism/determ021/determ021.stdout b/testsuite/tests/determinism/determ021/determ021.stdout index b9df4eaf07..cf171149db 100644 --- a/testsuite/tests/determinism/determ021/determ021.stdout +++ b/testsuite/tests/determinism/determ021/determ021.stdout @@ -1,7 +1,7 @@ [1 of 1] Compiling A ( A.hs, A.o ) TYPE SIGNATURES test2 :: - forall (f :: * -> *) t b. + forall {f :: * -> *} {t} {b}. (Applicative f, Num t, Num b) => (t -> f b) -> f b Dependent modules: [] @@ -10,7 +10,7 @@ Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, [1 of 1] Compiling A ( A.hs, A.o ) TYPE SIGNATURES test2 :: - forall (f :: * -> *) t b. + forall {f :: * -> *} {t} {b}. (Applicative f, Num t, Num b) => (t -> f b) -> f b Dependent modules: [] diff --git a/testsuite/tests/ghci/scripts/T13202a.stderr b/testsuite/tests/ghci/scripts/T13202a.stderr index 93bc2bb3ef..8b1851f175 100644 --- a/testsuite/tests/ghci/scripts/T13202a.stderr +++ b/testsuite/tests/ghci/scripts/T13202a.stderr @@ -3,4 +3,4 @@ • Non type-variable argument in the constraint: HasField "name" r a (Use FlexibleContexts to permit this) • When checking the inferred type - foo :: forall r a. HasField "name" r a => r -> a + foo :: forall {r} {a}. HasField "name" r a => r -> a diff --git a/testsuite/tests/ghci/scripts/T14969.stderr b/testsuite/tests/ghci/scripts/T14969.stderr index b581657d3c..13da943a3c 100644 --- a/testsuite/tests/ghci/scripts/T14969.stderr +++ b/testsuite/tests/ghci/scripts/T14969.stderr @@ -4,4 +4,4 @@ in the constraint: Num (t2 -> t1 -> t3) (Use FlexibleContexts to permit this) • When checking the inferred type - it :: forall t1 t2 t3. (Num t1, Num (t2 -> t1 -> t3)) => t3 + it :: forall {t1} {t2} {t3}. (Num t1, Num (t2 -> t1 -> t3)) => t3 diff --git a/testsuite/tests/ghci/scripts/T16030.stdout b/testsuite/tests/ghci/scripts/T16030.stdout index 4efa27ce70..987453b9ea 100644 --- a/testsuite/tests/ghci/scripts/T16030.stdout +++ b/testsuite/tests/ghci/scripts/T16030.stdout @@ -1,28 +1,28 @@ type role Foo1 phantom type Foo1 :: forall k. k -> * data Foo1 a where - MkFoo1a :: forall k (a :: k). Proxy a -> Int -> Foo1 a - MkFoo1b :: forall k (a :: k). {a :: Proxy a, b :: Int} -> Foo1 a + MkFoo1a :: forall {k} (a :: k). Proxy a -> Int -> Foo1 a + MkFoo1b :: forall {k} (a :: k). {a :: Proxy a, b :: Int} -> Foo1 a -- Defined at T16030.hs:8:1 type Foo2 :: forall k. k -> * data family Foo2 a -- Defined at T16030.hs:12:1 data instance forall k (a :: k). Foo2 a where - MkFoo2a :: forall k (a :: k). Proxy a -> Int -> Foo2 a - MkFoo2b :: forall k (a :: k). {c :: Proxy a, d :: Int} -> Foo2 a + MkFoo2a :: forall {k} (a :: k). Proxy a -> Int -> Foo2 a + MkFoo2b :: forall {k} (a :: k). {c :: Proxy a, d :: Int} -> Foo2 a -- Defined at T16030.hs:13:15 type role Foo1 nominal phantom type Foo1 :: forall k. k -> * data Foo1 @k a where - MkFoo1a :: forall k (a :: k). Proxy @{k} a -> Int -> Foo1 @k a - MkFoo1b :: forall k (a :: k). + MkFoo1a :: forall {k} (a :: k). Proxy @{k} a -> Int -> Foo1 @k a + MkFoo1b :: forall {k} (a :: k). {a :: Proxy @{k} a, b :: Int} -> Foo1 @k a -- Defined at T16030.hs:8:1 type Foo2 :: forall k. k -> * data family Foo2 @k a -- Defined at T16030.hs:12:1 data instance forall k (a :: k). Foo2 @k a where - MkFoo2a :: forall k (a :: k). Proxy @{k} a -> Int -> Foo2 @k a - MkFoo2b :: forall k (a :: k). + MkFoo2a :: forall {k} (a :: k). Proxy @{k} a -> Int -> Foo2 @k a + MkFoo2b :: forall {k} (a :: k). {c :: Proxy @{k} a, d :: Int} -> Foo2 @k a -- Defined at T16030.hs:13:15 diff --git a/testsuite/tests/ghci/scripts/T16804.stdout b/testsuite/tests/ghci/scripts/T16804.stdout index 897a42e48a..1c2d73b3c8 100644 --- a/testsuite/tests/ghci/scripts/T16804.stdout +++ b/testsuite/tests/ghci/scripts/T16804.stdout @@ -6,7 +6,7 @@ Collecting type info for 3 module(s) ... % ^~~~~~^ > % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":uses T16804a.hs 1 8 1 14" % file snippet: @@ -22,7 +22,7 @@ undefined :: forall a. a % ^~~^ > % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 3 8 3 18 undefined" % file snippet: @@ -31,7 +31,7 @@ undefined :: forall a. a % ^~~~~~~~~~^ > % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 3 13 3 18 undefined" % file snippet: @@ -40,7 +40,7 @@ undefined :: forall a. a % ^~~~~^ > % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":uses T16804a.hs 3 8 3 11" % file snippet: @@ -73,7 +73,7 @@ undefined :: forall a. a % ^~~^ > deriving (Show) % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 5 13 5 13 undefined" % file snippet: @@ -82,7 +82,7 @@ undefined :: forall a. a % ^ > deriving (Show) % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 5 15 5 15 undefined" % file snippet: @@ -91,7 +91,7 @@ undefined :: forall a. a % ^ > deriving (Show) % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 5 17 5 17 undefined" % file snippet: @@ -100,7 +100,7 @@ undefined :: forall a. a % ^ > deriving (Show) % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 6 13 6 16 undefined" % file snippet: @@ -160,7 +160,7 @@ T16804a.hs:(6,13)-(6,16) % ^~~~~^ > mempty = A % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 7 17 7 20 undefined" % file snippet: @@ -169,7 +169,7 @@ undefined :: forall a. a % ^~~^ > mempty = A % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 7 10 7 20 undefined" % file snippet: @@ -249,7 +249,7 @@ T16804a.hs:(8,3)-(8,8) % ^~~~~~~~~~~^ > testFunction A B = True % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 13 1 13 12 undefined" % file snippet: @@ -566,7 +566,7 @@ undefined :: Test > B <> _ = B % ^^ % output: -undefined :: forall a. a +undefined :: forall {a}. a % executing: ":type-at T16804a.hs 29 8 29 8 undefined" % file snippet: diff --git a/testsuite/tests/ghci/scripts/T6018ghcifail.stderr b/testsuite/tests/ghci/scripts/T6018ghcifail.stderr index bbea2d4398..30fbb0529f 100644 --- a/testsuite/tests/ghci/scripts/T6018ghcifail.stderr +++ b/testsuite/tests/ghci/scripts/T6018ghcifail.stderr @@ -59,7 +59,7 @@ Type family equation violates the family's injectivity annotation. Type/kind variable ‘k’ cannot be inferred from the right-hand side. In the type family equation: - forall k (a :: k) (b :: k). + forall {k} {a :: k} {b :: k}. Fc @k a b = Int -- Defined at <interactive>:64:15 <interactive>:68:15: error: @@ -67,7 +67,7 @@ Type/kind variables ‘k’, ‘a’, ‘b’ cannot be inferred from the right-hand side. In the type family equation: - forall k (a :: k) (b :: k). + forall {k} {a :: k} {b :: k}. Gc @k a b = Int -- Defined at <interactive>:68:15 <interactive>:81:15: error: diff --git a/testsuite/tests/ghci/scripts/T7730.stdout b/testsuite/tests/ghci/scripts/T7730.stdout index 9c3e385c71..4b0f1cea87 100644 --- a/testsuite/tests/ghci/scripts/T7730.stdout +++ b/testsuite/tests/ghci/scripts/T7730.stdout @@ -1,9 +1,9 @@ type role A phantom phantom -type A :: forall k k1. k -> k1 -> * +type A :: forall {k} {k1}. k -> k1 -> * data A x y -- Defined at <interactive>:2:1 A :: k1 -> k2 -> * type role T phantom -type T :: forall k. k -> * +type T :: forall {k}. k -> * data T a = forall a1. MkT a1 -- Defined at <interactive>:6:1 diff --git a/testsuite/tests/ghci/scripts/T7873.stdout b/testsuite/tests/ghci/scripts/T7873.stdout index 4abcab8c18..4347c3b9f3 100644 --- a/testsuite/tests/ghci/scripts/T7873.stdout +++ b/testsuite/tests/ghci/scripts/T7873.stdout @@ -1,6 +1,6 @@ type D2 :: * data D2 - = forall k. MkD2 (forall (p :: k -> *) (a :: k). p a -> Int) + = forall {k}. MkD2 (forall (p :: k -> *) (a :: k). p a -> Int) -- Defined at <interactive>:3:1 type D3 :: * data D3 = MkD3 (forall k (p :: k -> *) (a :: k). p a -> Int) diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout index 1b6b04e3f9..93739d04dc 100644 --- a/testsuite/tests/ghci/scripts/T7939.stdout +++ b/testsuite/tests/ghci/scripts/T7939.stdout @@ -1,6 +1,6 @@ -type Foo :: forall k. k -> Constraint +type Foo :: forall {k}. k -> Constraint class Foo a where - type Bar :: forall k. k -> * -> * + type Bar :: forall {k}. k -> * -> * type family Bar a b -- Defined at T7939.hs:6:4 Bar :: k -> * -> * @@ -19,13 +19,13 @@ type family H a where H 'False = 'True -- Defined at T7939.hs:14:1 H :: Bool -> Bool -type J :: forall k. [k] -> Bool +type J :: forall {k}. [k] -> Bool type family J a where J '[] = 'False forall k (h :: k) (t :: [k]). J (h : t) = 'True -- Defined at T7939.hs:17:1 J :: [k] -> Bool -type K :: forall a. [a] -> Maybe a +type K :: forall {a}. [a] -> Maybe a type family K a1 where K '[] = 'Nothing forall a (h :: a) (t :: [a]). K (h : t) = 'Just h diff --git a/testsuite/tests/ghci/should_run/T12549.stdout b/testsuite/tests/ghci/should_run/T12549.stdout index bd446f741a..8143b156c8 100644 --- a/testsuite/tests/ghci/should_run/T12549.stdout +++ b/testsuite/tests/ghci/should_run/T12549.stdout @@ -1,3 +1,3 @@ -f :: forall k1 k2 (a :: k1 -> k2 -> *) (b :: k1) (c :: k2). +f :: forall {k1} {k2} {a :: k1 -> k2 -> *} {b :: k1} {c :: k2}. C a => a b c diff --git a/testsuite/tests/indexed-types/should_compile/T15852.stderr b/testsuite/tests/indexed-types/should_compile/T15852.stderr index f4f2107240..73a072fe00 100644 --- a/testsuite/tests/indexed-types/should_compile/T15852.stderr +++ b/testsuite/tests/indexed-types/should_compile/T15852.stderr @@ -6,7 +6,7 @@ COERCION AXIOMS forall k1 k2 (j :: k1) (c :: k2). DF (Proxy c) = T15852.R:DFProxyProxy k1 k2 j c FAMILY INSTANCES - data instance forall k1 k2 (j :: k1) (c :: k2). + data instance forall {k1} {k2} {j :: k1} {c :: k2}. DF (Proxy c) -- Defined at T15852.hs:10:15 Dependent modules: [] Dependent packages: [base-4.14.0.0, ghc-prim-0.6.1, diff --git a/testsuite/tests/indexed-types/should_compile/T3017.stderr b/testsuite/tests/indexed-types/should_compile/T3017.stderr index c213d246fd..b6d187b160 100644 --- a/testsuite/tests/indexed-types/should_compile/T3017.stderr +++ b/testsuite/tests/indexed-types/should_compile/T3017.stderr @@ -3,7 +3,9 @@ TYPE SIGNATURES emptyL :: forall a. ListColl a insert :: forall c. Coll c => Elem c -> c -> c test2 :: - forall c a b. (Coll c, Num a, Num b, Elem c ~ (a, b)) => c -> c + forall {c} {a} {b}. + (Coll c, Num a, Num b, Elem c ~ (a, b)) => + c -> c TYPE CONSTRUCTORS class Coll{1} :: * -> Constraint associated type family Elem{1} :: * -> * diff --git a/testsuite/tests/indexed-types/should_fail/T15764.stderr b/testsuite/tests/indexed-types/should_fail/T15764.stderr index 5c04427841..aeb3f50457 100644 --- a/testsuite/tests/indexed-types/should_fail/T15764.stderr +++ b/testsuite/tests/indexed-types/should_fail/T15764.stderr @@ -1,7 +1,7 @@ T15764.hs:14:2: error: • The kind of ‘T6’ is ill-scoped - Inferred kind: T6 :: forall (a :: k) k (b :: Proxy a). + Inferred kind: T6 :: forall {a :: k} k (b :: Proxy a). Proxy '(k, b) -> * NB: Inferred variables (namely: (a :: k)) always come first diff --git a/testsuite/tests/indexed-types/should_fail/T1897b.stderr b/testsuite/tests/indexed-types/should_fail/T1897b.stderr index 59109982ea..a2055816ae 100644 --- a/testsuite/tests/indexed-types/should_fail/T1897b.stderr +++ b/testsuite/tests/indexed-types/should_fail/T1897b.stderr @@ -8,6 +8,6 @@ T1897b.hs:16:1: error: • In the ambiguity check for the inferred type for ‘isValid’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - isValid :: forall (t :: * -> *) a. + isValid :: forall {t :: * -> *} {a}. (Foldable t, Bug a) => t (Depend a) -> Bool diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr index 37ada9e6bc..4332d07a03 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - bravo :: forall _. Num _ => _ + bravo :: forall {_}. Num _ => _ Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr index 37ada9e6bc..4332d07a03 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - bravo :: forall _. Num _ => _ + bravo :: forall {_}. Num _ => _ Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Either.stderr b/testsuite/tests/partial-sigs/should_compile/Either.stderr index d7a636413c..f5f54d209e 100644 --- a/testsuite/tests/partial-sigs/should_compile/Either.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Either.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - barry :: forall _. _ -> (Either [Char] _, Either [Char] _) + barry :: forall {_}. _ -> (Either [Char] _, Either [Char] _) Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/Every.stderr b/testsuite/tests/partial-sigs/should_compile/Every.stderr index 3e33dcbf48..d9f69686e1 100644 --- a/testsuite/tests/partial-sigs/should_compile/Every.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Every.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - every :: forall t. (t -> Bool) -> [t] -> Bool + every :: forall {t}. (t -> Bool) -> [t] -> Bool Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr index 3cbaff90ac..28c25b80b6 100644 --- a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - every :: forall _. (_ -> Bool) -> [_] -> Bool + every :: forall {_}. (_ -> Bool) -> [_] -> Bool Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr index 064c995300..3b94743dbb 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr @@ -1,231 +1,239 @@ TYPE SIGNATURES - !! :: forall a. [a] -> Int -> a - $ :: forall a b. (a -> b) -> a -> b - $! :: forall a b. (a -> b) -> a -> b + !! :: forall {a}. [a] -> Int -> a + $ :: forall {a} {b}. (a -> b) -> a -> b + $! :: forall {a} {b}. (a -> b) -> a -> b && :: Bool -> Bool -> Bool - * :: forall a. Num a => a -> a -> a - ** :: forall a. Floating a => a -> a -> a - + :: forall a. Num a => a -> a -> a - ++ :: forall a. [a] -> [a] -> [a] - - :: forall a. Num a => a -> a -> a - . :: forall b c a. (b -> c) -> (a -> b) -> a -> c - / :: forall a. Fractional a => a -> a -> a - /= :: forall a. Eq a => a -> a -> Bool - < :: forall a. Ord a => a -> a -> Bool - <= :: forall a. Ord a => a -> a -> Bool + * :: forall {a}. Num a => a -> a -> a + ** :: forall {a}. Floating a => a -> a -> a + + :: forall {a}. Num a => a -> a -> a + ++ :: forall {a}. [a] -> [a] -> [a] + - :: forall {a}. Num a => a -> a -> a + . :: forall {b} {c} {a}. (b -> c) -> (a -> b) -> a -> c + / :: forall {a}. Fractional a => a -> a -> a + /= :: forall {a}. Eq a => a -> a -> Bool + < :: forall {a}. Ord a => a -> a -> Bool + <= :: forall {a}. Ord a => a -> a -> Bool =<< :: - forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b - == :: forall a. Eq a => a -> a -> Bool - > :: forall a. Ord a => a -> a -> Bool - >= :: forall a. Ord a => a -> a -> Bool - >> :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b + forall {m :: * -> *} {a} {b}. Monad m => (a -> m b) -> m a -> m b + == :: forall {a}. Eq a => a -> a -> Bool + > :: forall {a}. Ord a => a -> a -> Bool + >= :: forall {a}. Ord a => a -> a -> Bool + >> :: forall {m :: * -> *} {a} {b}. Monad m => m a -> m b -> m b >>= :: - forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b - ^ :: forall b a. (Integral b, Num a) => a -> b -> a - ^^ :: forall a b. (Fractional a, Integral b) => a -> b -> a - abs :: forall a. Num a => a -> a - acos :: forall a. Floating a => a -> a - acosh :: forall a. Floating a => a -> a + forall {m :: * -> *} {a} {b}. Monad m => m a -> (a -> m b) -> m b + ^ :: forall {b} {a}. (Integral b, Num a) => a -> b -> a + ^^ :: forall {a} {b}. (Fractional a, Integral b) => a -> b -> a + abs :: forall {a}. Num a => a -> a + acos :: forall {a}. Floating a => a -> a + acosh :: forall {a}. Floating a => a -> a all :: - forall (t :: * -> *) a. P.Foldable t => (a -> Bool) -> t a -> Bool - and :: forall (t :: * -> *). P.Foldable t => t Bool -> Bool + forall {t :: * -> *} {a}. + P.Foldable t => + (a -> Bool) -> t a -> Bool + and :: forall {t :: * -> *}. P.Foldable t => t Bool -> Bool any :: - forall (t :: * -> *) a. P.Foldable t => (a -> Bool) -> t a -> Bool + forall {t :: * -> *} {a}. + P.Foldable t => + (a -> Bool) -> t a -> Bool appendFile :: FilePath -> String -> IO () - asTypeOf :: forall a. a -> a -> a - asin :: forall a. Floating a => a -> a - asinh :: forall a. Floating a => a -> a - atan :: forall a. Floating a => a -> a - atan2 :: forall a. RealFloat a => a -> a -> a - atanh :: forall a. Floating a => a -> a - break :: forall a. (a -> Bool) -> [a] -> ([a], [a]) - ceiling :: forall a b. (RealFrac a, Integral b) => a -> b - compare :: forall a. Ord a => a -> a -> Ordering - concat :: forall (t :: * -> *) a. P.Foldable t => t [a] -> [a] + asTypeOf :: forall {a}. a -> a -> a + asin :: forall {a}. Floating a => a -> a + asinh :: forall {a}. Floating a => a -> a + atan :: forall {a}. Floating a => a -> a + atan2 :: forall {a}. RealFloat a => a -> a -> a + atanh :: forall {a}. Floating a => a -> a + break :: forall {a}. (a -> Bool) -> [a] -> ([a], [a]) + ceiling :: forall {a} {b}. (RealFrac a, Integral b) => a -> b + compare :: forall {a}. Ord a => a -> a -> Ordering + concat :: forall {t :: * -> *} {a}. P.Foldable t => t [a] -> [a] concatMap :: - forall (t :: * -> *) a b. P.Foldable t => (a -> [b]) -> t a -> [b] - const :: forall a b. a -> b -> a - cos :: forall a. Floating a => a -> a - cosh :: forall a. Floating a => a -> a - curry :: forall a b c. ((a, b) -> c) -> a -> b -> c - cycle :: forall a. [a] -> [a] - decodeFloat :: forall a. RealFloat a => a -> (Integer, Int) - div :: forall a. Integral a => a -> a -> a - divMod :: forall a. Integral a => a -> a -> (a, a) - drop :: forall a. Int -> [a] -> [a] - dropWhile :: forall a. (a -> Bool) -> [a] -> [a] - either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c + forall {t :: * -> *} {a} {b}. + P.Foldable t => + (a -> [b]) -> t a -> [b] + const :: forall {a} {b}. a -> b -> a + cos :: forall {a}. Floating a => a -> a + cosh :: forall {a}. Floating a => a -> a + curry :: forall {a} {b} {c}. ((a, b) -> c) -> a -> b -> c + cycle :: forall {a}. [a] -> [a] + decodeFloat :: forall {a}. RealFloat a => a -> (Integer, Int) + div :: forall {a}. Integral a => a -> a -> a + divMod :: forall {a}. Integral a => a -> a -> (a, a) + drop :: forall {a}. Int -> [a] -> [a] + dropWhile :: forall {a}. (a -> Bool) -> [a] -> [a] + either :: + forall {a} {c} {b}. (a -> c) -> (b -> c) -> Either a b -> c elem :: - forall (t :: * -> *) a. (P.Foldable t, Eq a) => a -> t a -> Bool - encodeFloat :: forall a. RealFloat a => Integer -> Int -> a - enumFrom :: forall a. Enum a => a -> [a] - enumFromThen :: forall a. Enum a => a -> a -> [a] - enumFromThenTo :: forall a. Enum a => a -> a -> a -> [a] - enumFromTo :: forall a. Enum a => a -> a -> [a] - error :: forall a. [Char] -> a - even :: forall a. Integral a => a -> Bool - exp :: forall a. Floating a => a -> a - exponent :: forall a. RealFloat a => a -> Int - fail :: forall (m :: * -> *) a. P.MonadFail m => String -> m a - filter :: forall a. (a -> Bool) -> [a] -> [a] - flip :: forall a b c. (a -> b -> c) -> b -> a -> c - floatDigits :: forall a. RealFloat a => a -> Int - floatRadix :: forall a. RealFloat a => a -> Integer - floatRange :: forall a. RealFloat a => a -> (Int, Int) - floor :: forall a b. (RealFrac a, Integral b) => a -> b + forall {t :: * -> *} {a}. (P.Foldable t, Eq a) => a -> t a -> Bool + encodeFloat :: forall {a}. RealFloat a => Integer -> Int -> a + enumFrom :: forall {a}. Enum a => a -> [a] + enumFromThen :: forall {a}. Enum a => a -> a -> [a] + enumFromThenTo :: forall {a}. Enum a => a -> a -> a -> [a] + enumFromTo :: forall {a}. Enum a => a -> a -> [a] + error :: forall {a}. [Char] -> a + even :: forall {a}. Integral a => a -> Bool + exp :: forall {a}. Floating a => a -> a + exponent :: forall {a}. RealFloat a => a -> Int + fail :: forall {m :: * -> *} {a}. P.MonadFail m => String -> m a + filter :: forall {a}. (a -> Bool) -> [a] -> [a] + flip :: forall {a} {b} {c}. (a -> b -> c) -> b -> a -> c + floatDigits :: forall {a}. RealFloat a => a -> Int + floatRadix :: forall {a}. RealFloat a => a -> Integer + floatRange :: forall {a}. RealFloat a => a -> (Int, Int) + floor :: forall {a} {b}. (RealFrac a, Integral b) => a -> b fmap :: - forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b + forall {f :: * -> *} {a} {b}. Functor f => (a -> b) -> f a -> f b foldl :: - forall (t :: * -> *) b a. + forall {t :: * -> *} {b} {a}. P.Foldable t => (b -> a -> b) -> b -> t a -> b foldl1 :: - forall (t :: * -> *) a. P.Foldable t => (a -> a -> a) -> t a -> a + forall {t :: * -> *} {a}. P.Foldable t => (a -> a -> a) -> t a -> a foldr :: - forall (t :: * -> *) a b. + forall {t :: * -> *} {a} {b}. P.Foldable t => (a -> b -> b) -> b -> t a -> b foldr1 :: - forall (t :: * -> *) a. P.Foldable t => (a -> a -> a) -> t a -> a - fromEnum :: forall a. Enum a => a -> Int - fromInteger :: forall a. Num a => Integer -> a - fromIntegral :: forall a b. (Integral a, Num b) => a -> b - fromRational :: forall a. Fractional a => Rational -> a - fst :: forall a b. (a, b) -> a - gcd :: forall a. Integral a => a -> a -> a + forall {t :: * -> *} {a}. P.Foldable t => (a -> a -> a) -> t a -> a + fromEnum :: forall {a}. Enum a => a -> Int + fromInteger :: forall {a}. Num a => Integer -> a + fromIntegral :: forall {a} {b}. (Integral a, Num b) => a -> b + fromRational :: forall {a}. Fractional a => Rational -> a + fst :: forall {a} {b}. (a, b) -> a + gcd :: forall {a}. Integral a => a -> a -> a getChar :: IO Char getContents :: IO String getLine :: IO String - head :: forall a. [a] -> a - id :: forall a. a -> a - init :: forall a. [a] -> [a] + head :: forall {a}. [a] -> a + id :: forall {a}. a -> a + init :: forall {a}. [a] -> [a] interact :: (String -> String) -> IO () - ioError :: forall a. IOError -> IO a - isDenormalized :: forall a. RealFloat a => a -> Bool - isIEEE :: forall a. RealFloat a => a -> Bool - isInfinite :: forall a. RealFloat a => a -> Bool - isNaN :: forall a. RealFloat a => a -> Bool - isNegativeZero :: forall a. RealFloat a => a -> Bool - iterate :: forall a. (a -> a) -> a -> [a] - last :: forall a. [a] -> a - lcm :: forall a. Integral a => a -> a -> a - length :: forall (t :: * -> *) a. P.Foldable t => t a -> Int + ioError :: forall {a}. IOError -> IO a + isDenormalized :: forall {a}. RealFloat a => a -> Bool + isIEEE :: forall {a}. RealFloat a => a -> Bool + isInfinite :: forall {a}. RealFloat a => a -> Bool + isNaN :: forall {a}. RealFloat a => a -> Bool + isNegativeZero :: forall {a}. RealFloat a => a -> Bool + iterate :: forall {a}. (a -> a) -> a -> [a] + last :: forall {a}. [a] -> a + lcm :: forall {a}. Integral a => a -> a -> a + length :: forall {t :: * -> *} {a}. P.Foldable t => t a -> Int lex :: ReadS String lines :: String -> [String] - log :: forall a. Floating a => a -> a - logBase :: forall a. Floating a => a -> a -> a - lookup :: forall a b. Eq a => a -> [(a, b)] -> Maybe b - map :: forall a b. (a -> b) -> [a] -> [b] + log :: forall {a}. Floating a => a -> a + logBase :: forall {a}. Floating a => a -> a -> a + lookup :: forall {a} {b}. Eq a => a -> [(a, b)] -> Maybe b + map :: forall {a} {b}. (a -> b) -> [a] -> [b] mapM :: - forall (t :: * -> *) (m :: * -> *) a b. + forall {t :: * -> *} {m :: * -> *} {a} {b}. (P.Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) mapM_ :: - forall (t :: * -> *) (m :: * -> *) a b. + forall {t :: * -> *} {m :: * -> *} {a} {b}. (P.Foldable t, Monad m) => (a -> m b) -> t a -> m () - max :: forall a. Ord a => a -> a -> a - maxBound :: forall _. Bounded _ => _ + max :: forall {a}. Ord a => a -> a -> a + maxBound :: forall {_}. Bounded _ => _ maximum :: - forall (t :: * -> *) a. (P.Foldable t, Ord a) => t a -> a - maybe :: forall b a. b -> (a -> b) -> Maybe a -> b - min :: forall a. Ord a => a -> a -> a - minBound :: forall _. Bounded _ => _ + forall {t :: * -> *} {a}. (P.Foldable t, Ord a) => t a -> a + maybe :: forall {b} {a}. b -> (a -> b) -> Maybe a -> b + min :: forall {a}. Ord a => a -> a -> a + minBound :: forall {_}. Bounded _ => _ minimum :: - forall (t :: * -> *) a. (P.Foldable t, Ord a) => t a -> a - mod :: forall a. Integral a => a -> a -> a - negate :: forall a. Num a => a -> a + forall {t :: * -> *} {a}. (P.Foldable t, Ord a) => t a -> a + mod :: forall {a}. Integral a => a -> a -> a + negate :: forall {a}. Num a => a -> a not :: Bool -> Bool notElem :: - forall (t :: * -> *) a. (P.Foldable t, Eq a) => a -> t a -> Bool - null :: forall (t :: * -> *) a. P.Foldable t => t a -> Bool - odd :: forall a. Integral a => a -> Bool - or :: forall (t :: * -> *). P.Foldable t => t Bool -> Bool + forall {t :: * -> *} {a}. (P.Foldable t, Eq a) => a -> t a -> Bool + null :: forall {t :: * -> *} {a}. P.Foldable t => t a -> Bool + odd :: forall {a}. Integral a => a -> Bool + or :: forall {t :: * -> *}. P.Foldable t => t Bool -> Bool otherwise :: Bool - pi :: forall _. Floating _ => _ - pred :: forall a. Enum a => a -> a - print :: forall a. Show a => a -> IO () + pi :: forall {_}. Floating _ => _ + pred :: forall {a}. Enum a => a -> a + print :: forall {a}. Show a => a -> IO () product :: - forall (t :: * -> *) a. (P.Foldable t, Num a) => t a -> a + forall {t :: * -> *} {a}. (P.Foldable t, Num a) => t a -> a properFraction :: - forall a b. (RealFrac a, Integral b) => a -> (b, a) + forall {a} {b}. (RealFrac a, Integral b) => a -> (b, a) putChar :: Char -> IO () putStr :: String -> IO () putStrLn :: String -> IO () - quot :: forall a. Integral a => a -> a -> a - quotRem :: forall a. Integral a => a -> a -> (a, a) - read :: forall a. Read a => String -> a + quot :: forall {a}. Integral a => a -> a -> a + quotRem :: forall {a}. Integral a => a -> a -> (a, a) + read :: forall {a}. Read a => String -> a readFile :: FilePath -> IO String - readIO :: forall a. Read a => String -> IO a - readList :: forall a. Read a => ReadS [a] - readLn :: forall a. Read a => IO a - readParen :: forall a. Bool -> ReadS a -> ReadS a - reads :: forall a. Read a => ReadS a - readsPrec :: forall a. Read a => Int -> ReadS a - realToFrac :: forall a b. (Real a, Fractional b) => a -> b - recip :: forall a. Fractional a => a -> a - rem :: forall a. Integral a => a -> a -> a - repeat :: forall a. a -> [a] - replicate :: forall a. Int -> a -> [a] - return :: forall (m :: * -> *) a. Monad m => a -> m a - reverse :: forall a. [a] -> [a] - round :: forall a b. (RealFrac a, Integral b) => a -> b - scaleFloat :: forall a. RealFloat a => Int -> a -> a - scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b] - scanl1 :: forall a. (a -> a -> a) -> [a] -> [a] - scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b] - scanr1 :: forall a. (a -> a -> a) -> [a] -> [a] - seq :: forall a b. a -> b -> b + readIO :: forall {a}. Read a => String -> IO a + readList :: forall {a}. Read a => ReadS [a] + readLn :: forall {a}. Read a => IO a + readParen :: forall {a}. Bool -> ReadS a -> ReadS a + reads :: forall {a}. Read a => ReadS a + readsPrec :: forall {a}. Read a => Int -> ReadS a + realToFrac :: forall {a} {b}. (Real a, Fractional b) => a -> b + recip :: forall {a}. Fractional a => a -> a + rem :: forall {a}. Integral a => a -> a -> a + repeat :: forall {a}. a -> [a] + replicate :: forall {a}. Int -> a -> [a] + return :: forall {m :: * -> *} {a}. Monad m => a -> m a + reverse :: forall {a}. [a] -> [a] + round :: forall {a} {b}. (RealFrac a, Integral b) => a -> b + scaleFloat :: forall {a}. RealFloat a => Int -> a -> a + scanl :: forall {b} {a}. (b -> a -> b) -> b -> [a] -> [b] + scanl1 :: forall {a}. (a -> a -> a) -> [a] -> [a] + scanr :: forall {a} {b}. (a -> b -> b) -> b -> [a] -> [b] + scanr1 :: forall {a}. (a -> a -> a) -> [a] -> [a] + seq :: forall {a} {b}. a -> b -> b sequence :: - forall (t :: * -> *) (m :: * -> *) a. + forall {t :: * -> *} {m :: * -> *} {a}. (P.Traversable t, Monad m) => t (m a) -> m (t a) sequence_ :: - forall (t :: * -> *) (m :: * -> *) a. + forall {t :: * -> *} {m :: * -> *} {a}. (P.Foldable t, Monad m) => t (m a) -> m () - show :: forall a. Show a => a -> String + show :: forall {a}. Show a => a -> String showChar :: Char -> ShowS - showList :: forall a. Show a => [a] -> ShowS + showList :: forall {a}. Show a => [a] -> ShowS showParen :: Bool -> ShowS -> ShowS showString :: String -> ShowS - shows :: forall a. Show a => a -> ShowS - showsPrec :: forall a. Show a => Int -> a -> ShowS - significand :: forall a. RealFloat a => a -> a - signum :: forall a. Num a => a -> a - sin :: forall a. Floating a => a -> a - sinh :: forall a. Floating a => a -> a - snd :: forall a b. (a, b) -> b - span :: forall a. (a -> Bool) -> [a] -> ([a], [a]) - splitAt :: forall a. Int -> [a] -> ([a], [a]) - sqrt :: forall a. Floating a => a -> a - subtract :: forall a. Num a => a -> a -> a - succ :: forall a. Enum a => a -> a - sum :: forall (t :: * -> *) a. (P.Foldable t, Num a) => t a -> a - tail :: forall a. [a] -> [a] - take :: forall a. Int -> [a] -> [a] - takeWhile :: forall a. (a -> Bool) -> [a] -> [a] - tan :: forall a. Floating a => a -> a - tanh :: forall a. Floating a => a -> a - toEnum :: forall a. Enum a => Int -> a - toInteger :: forall a. Integral a => a -> Integer - toRational :: forall a. Real a => a -> Rational - truncate :: forall a b. (RealFrac a, Integral b) => a -> b - uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c - undefined :: forall _. _ + shows :: forall {a}. Show a => a -> ShowS + showsPrec :: forall {a}. Show a => Int -> a -> ShowS + significand :: forall {a}. RealFloat a => a -> a + signum :: forall {a}. Num a => a -> a + sin :: forall {a}. Floating a => a -> a + sinh :: forall {a}. Floating a => a -> a + snd :: forall {a} {b}. (a, b) -> b + span :: forall {a}. (a -> Bool) -> [a] -> ([a], [a]) + splitAt :: forall {a}. Int -> [a] -> ([a], [a]) + sqrt :: forall {a}. Floating a => a -> a + subtract :: forall {a}. Num a => a -> a -> a + succ :: forall {a}. Enum a => a -> a + sum :: forall {t :: * -> *} {a}. (P.Foldable t, Num a) => t a -> a + tail :: forall {a}. [a] -> [a] + take :: forall {a}. Int -> [a] -> [a] + takeWhile :: forall {a}. (a -> Bool) -> [a] -> [a] + tan :: forall {a}. Floating a => a -> a + tanh :: forall {a}. Floating a => a -> a + toEnum :: forall {a}. Enum a => Int -> a + toInteger :: forall {a}. Integral a => a -> Integer + toRational :: forall {a}. Real a => a -> Rational + truncate :: forall {a} {b}. (RealFrac a, Integral b) => a -> b + uncurry :: forall {a} {b} {c}. (a -> b -> c) -> (a, b) -> c + undefined :: forall {_}. _ unlines :: [String] -> String - until :: forall a. (a -> Bool) -> (a -> a) -> a -> a + until :: forall {a}. (a -> Bool) -> (a -> a) -> a -> a unwords :: [String] -> String - unzip :: forall a b. [(a, b)] -> ([a], [b]) - unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c]) + unzip :: forall {a} {b}. [(a, b)] -> ([a], [b]) + unzip3 :: forall {a} {b} {c}. [(a, b, c)] -> ([a], [b], [c]) userError :: String -> IOError words :: String -> [String] writeFile :: FilePath -> String -> IO () - zip :: forall a b. [a] -> [b] -> [(a, b)] - zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)] - zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] + zip :: forall {a} {b}. [a] -> [b] -> [(a, b)] + zip3 :: forall {a} {b} {c}. [a] -> [b] -> [c] -> [(a, b, c)] + zipWith :: forall {a} {b} {c}. (a -> b -> c) -> [a] -> [b] -> [c] zipWith3 :: - forall a b c d. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] + forall {a} {b} {c} {d}. + (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] || :: Bool -> Bool -> Bool Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, diff --git a/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr b/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr index 025fa95a42..6380befcc2 100644 --- a/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr @@ -1,7 +1,7 @@ TYPE SIGNATURES isMeltdown :: forall param1 param2. NukeMonad param1 param2 Bool unlessMeltdown :: - forall param1 param2. + forall {param1} {param2}. NukeMonad param1 param2 () -> NukeMonad param1 param2 () TYPE CONSTRUCTORS data type NukeMonad{3} :: * -> * -> * -> * diff --git a/testsuite/tests/partial-sigs/should_compile/PatBind.stderr b/testsuite/tests/partial-sigs/should_compile/PatBind.stderr index de26dc9d80..1f71b4f434 100644 --- a/testsuite/tests/partial-sigs/should_compile/PatBind.stderr +++ b/testsuite/tests/partial-sigs/should_compile/PatBind.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - foo :: forall a. a -> a + foo :: forall {a}. a -> a Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr index 86054ed585..8ca152fd92 100644 --- a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - showTwo :: forall a. Show a => a -> String + showTwo :: forall {a}. Show a => a -> String Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr index 34903a93cf..49e98e3b0d 100644 --- a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - bar :: forall _. _ -> Bool + bar :: forall {_}. _ -> Bool Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr index da0aa8ed9e..4a205f9ca5 100644 --- a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr @@ -1,6 +1,6 @@ TYPE SIGNATURES skipMany :: - forall tok st a. GenParser tok st a -> GenParser tok st () + forall {tok} {st} {a}. GenParser tok st a -> GenParser tok st () skipMany' :: forall tok st a. GenParser tok st a -> GenParser tok st () TYPE CONSTRUCTORS diff --git a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr index 68bec65094..0499a2eb93 100644 --- a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - unc :: forall _1 _2 _3. (_1 -> _2 -> _3) -> (_1, _2) -> _3 + unc :: forall {_1} {_2} {_3}. (_1 -> _2 -> _3) -> (_1, _2) -> _3 Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr index 9d5f8e20be..62ae68aef0 100644 --- a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - unc :: forall a b _. (a -> b -> _) -> (a, b) -> _ + unc :: forall {a} {b} {_}. (a -> b -> _) -> (a, b) -> _ Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr index 4dbb77b300..8cfb1f2fe0 100644 --- a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr @@ -1,6 +1,6 @@ TYPE SIGNATURES - bar :: forall t _. t -> (t -> _) -> _ - foo :: forall a. (Show a, Enum a) => a -> String + bar :: forall {t} {_}. t -> (t -> _) -> _ + foo :: forall {a}. (Show a, Enum a) => a -> String Dependent modules: [] Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1, integer-gmp-1.0.2.0] diff --git a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr index c573747c02..84d61eda91 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr @@ -3,9 +3,9 @@ NamedExtraConstraintsWildcard.hs:5:1: error: • Could not deduce: _0 from the context: (Eq a, _) bound by the inferred type for ‘foo’: - forall a (_ :: Constraint). (Eq a, _) => a -> a + forall a {_ :: Constraint}. (Eq a, _) => a -> a at NamedExtraConstraintsWildcard.hs:5:1-15 • In the ambiguity check for the inferred type for ‘foo’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - foo :: forall a (_ :: Constraint). (Eq a, _) => a -> a + foo :: forall a {_ :: Constraint}. (Eq a, _) => a -> a diff --git a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr index 89b71e5959..6a1d0edbb4 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr @@ -3,10 +3,10 @@ NamedWildcardsNotInMonotype.hs:5:1: error: • Could not deduce (Eq _0) from the context: (Show a, Eq _, Eq a) bound by the inferred type for ‘foo’: - forall a _. (Show a, Eq _, Eq a) => a -> a -> String + forall {a} {_}. (Show a, Eq _, Eq a) => a -> a -> String at NamedWildcardsNotInMonotype.hs:5:1-33 The type variable ‘_0’ is ambiguous • In the ambiguity check for the inferred type for ‘foo’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - foo :: forall a _. (Show a, Eq _, Eq a) => a -> a -> String + foo :: forall {a} {_}. (Show a, Eq _, Eq a) => a -> a -> String diff --git a/testsuite/tests/partial-sigs/should_fail/T14584a.stderr b/testsuite/tests/partial-sigs/should_fail/T14584a.stderr index 5687dcec51..8c98b76ae2 100644 --- a/testsuite/tests/partial-sigs/should_fail/T14584a.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T14584a.stderr @@ -14,7 +14,7 @@ T14584a.hs:12:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘m -> m’ Where: ‘m’, ‘k’ are rigid type variables bound by the type signature for: - f :: forall k2 (m :: k2). () + f :: forall {k2} (m :: k2). () at T14584a.hs:11:1-17 • In an expression type signature: _ In the expression: id @m :: _ diff --git a/testsuite/tests/patsyn/should_compile/T11213.stderr b/testsuite/tests/patsyn/should_compile/T11213.stderr index 212e3e9334..8d65044ec6 100644 --- a/testsuite/tests/patsyn/should_compile/T11213.stderr +++ b/testsuite/tests/patsyn/should_compile/T11213.stderr @@ -4,48 +4,48 @@ T11213.hs:19:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] T11213.hs:20:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pe :: () => forall a. a -> Ex + pattern Pe :: () => forall {a}. a -> Ex T11213.hs:21:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pu :: forall p. p -> p + pattern Pu :: forall {p}. p -> p T11213.hs:22:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pue :: forall a. () => forall a1. a -> a1 -> (a, Ex) + pattern Pue :: forall {a}. () => forall {a1}. a -> a1 -> (a, Ex) T11213.hs:23:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pur :: forall a. (Eq a, Num a) => a -> [a] + pattern Pur :: forall {a}. (Eq a, Num a) => a -> [a] T11213.hs:24:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Purp :: forall a1 a2. + pattern Purp :: forall {a1} {a2}. (Eq a1, Num a1) => Show a2 => a1 -> a2 -> ([a1], UnivProv a2) T11213.hs:25:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pure :: forall a. + pattern Pure :: forall {a}. (Eq a, Num a) => - forall a1. a -> a1 -> ([a], Ex) + forall {a1}. a -> a1 -> ([a], Ex) T11213.hs:26:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Purep :: forall a. + pattern Purep :: forall {a}. (Eq a, Num a) => - forall a1. Show a1 => a -> a1 -> ([a], ExProv) + forall {a1}. Show a1 => a -> a1 -> ([a], ExProv) T11213.hs:27:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pep :: () => forall a. Show a => a -> ExProv + pattern Pep :: () => forall {a}. Show a => a -> ExProv T11213.hs:28:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Pup :: forall a. () => Show a => a -> UnivProv a + pattern Pup :: forall {a}. () => Show a => a -> UnivProv a T11213.hs:29:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern Puep :: forall b. + pattern Puep :: forall {b}. () => - forall a. Show a => a -> b -> (ExProv, b) + forall {a}. Show a => a -> b -> (ExProv, b) diff --git a/testsuite/tests/patsyn/should_compile/T12484.stderr b/testsuite/tests/patsyn/should_compile/T12484.stderr index d51b6fe393..6e73612518 100644 --- a/testsuite/tests/patsyn/should_compile/T12484.stderr +++ b/testsuite/tests/patsyn/should_compile/T12484.stderr @@ -1,4 +1,4 @@ T12484.hs:6:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern RP :: forall a. a -> (a, Bool) + pattern RP :: forall {a}. a -> (a, Bool) diff --git a/testsuite/tests/patsyn/should_compile/T14394.stdout b/testsuite/tests/patsyn/should_compile/T14394.stdout index f59f62cb78..83e745c60a 100644 --- a/testsuite/tests/patsyn/should_compile/T14394.stdout +++ b/testsuite/tests/patsyn/should_compile/T14394.stdout @@ -1,7 +1,7 @@ pattern Foo :: () => (b ~ a) => a :~~: b -- Defined at <interactive>:5:1 pattern Bar - :: forall k1 k2 (a :: k1) (b :: k2). + :: forall {k1} {k2} {a :: k1} {b :: k2}. () => (k2 ~ k1, b ~~ a) => a :~~: b diff --git a/testsuite/tests/patsyn/should_fail/T11053.stderr b/testsuite/tests/patsyn/should_fail/T11053.stderr index 5e50a9143f..7aaf7ff26c 100644 --- a/testsuite/tests/patsyn/should_fail/T11053.stderr +++ b/testsuite/tests/patsyn/should_fail/T11053.stderr @@ -4,16 +4,16 @@ T11053.hs:7:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] T11053.hs:9:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern J :: forall a. a -> Maybe a + pattern J :: forall {a}. a -> Maybe a T11053.hs:11:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern J1 :: forall a. a -> Maybe a + pattern J1 :: forall {a}. a -> Maybe a T11053.hs:13:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern J2 :: forall a. a -> Maybe a + pattern J2 :: forall {a}. a -> Maybe a T11053.hs:15:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: - pattern J3 :: forall a. a -> Maybe a + pattern J3 :: forall {a}. a -> Maybe a diff --git a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs index 4162fc24be..b0ede20d41 100644 --- a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs +++ b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs @@ -53,7 +53,7 @@ typecheckPlugin [name, "typecheck"] _ tc typecheckPlugin _ _ tc = return tc metaPlugin' :: [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc) -metaPlugin' [name, "meta"] (L l (XExpr (HsWrap w (HsPar x (L _ (HsApp noExt (L _ (HsVar _ (L _ id))) e)))))) +metaPlugin' [name, "meta"] (L l (HsPar x (L _ (XExpr (HsWrap w (HsApp noExt (L _ (HsVar _ (L _ id))) e)))))) | occNameString (getOccName id) == name = return (L l (XExpr (HsWrap w (unLoc e)))) -- The test should always match this first case. If the desugaring changes diff --git a/testsuite/tests/polykinds/T11459.stderr b/testsuite/tests/polykinds/T11459.stderr index 72651a4e10..724395ecd7 100644 --- a/testsuite/tests/polykinds/T11459.stderr +++ b/testsuite/tests/polykinds/T11459.stderr @@ -1,7 +1,7 @@ T11459.hs:9:20: error: • A newtype constructor cannot have existential type variables - Parser :: forall a k. + Parser :: forall a {k}. (forall (f :: k -> *) (r :: k). Failure f r -> Success a f r -> f r) -> Parser a diff --git a/testsuite/tests/polykinds/T14561.stderr b/testsuite/tests/polykinds/T14561.stderr index 05814f387c..16e3be33b2 100644 --- a/testsuite/tests/polykinds/T14561.stderr +++ b/testsuite/tests/polykinds/T14561.stderr @@ -2,4 +2,7 @@ T14561.hs:12:9: error: Cannot use function with levity-polymorphic arguments: unsafeCoerce# :: a -> a + (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples + are eta-expanded internally because they must occur fully saturated. + Use -fprint-typechecker-elaboration to display the full expression.) Levity-polymorphic arguments: a :: TYPE r diff --git a/testsuite/tests/polykinds/T14846.stderr b/testsuite/tests/polykinds/T14846.stderr index 6e8384542f..83e32f7a21 100644 --- a/testsuite/tests/polykinds/T14846.stderr +++ b/testsuite/tests/polykinds/T14846.stderr @@ -3,7 +3,7 @@ T14846.hs:38:8: error: • Couldn't match type ‘ríki’ with ‘Hom riki’ ‘ríki’ is a rigid type variable bound by the type signature for: - i :: forall k5 k6 (cls2 :: k6 -> Constraint) (xx :: k5) + i :: forall {k5} {k6} {cls2 :: k6 -> Constraint} (xx :: k5) (a :: Struct cls2) (ríki :: Struct cls2 -> Struct cls2 -> *). StructI xx a => ríki a a @@ -12,11 +12,11 @@ T14846.hs:38:8: error: Actual type: Hom riki a a • When checking that instance signature for ‘i’ is more general than its signature in the class - Instance sig: forall k1 k2 (cls :: k2 -> Constraint) (xx :: k1) + Instance sig: forall {k1} {k2} {cls :: k2 -> Constraint} (xx :: k1) (a :: Struct cls). StructI xx a => Hom riki a a - Class sig: forall k1 k2 (cls :: k2 -> Constraint) (xx :: k1) + Class sig: forall {k1} {k2} {cls :: k2 -> Constraint} (xx :: k1) (a :: Struct cls) (ríki :: Struct cls -> Struct cls -> *). StructI xx a => ríki a a diff --git a/testsuite/tests/polykinds/T7230.stderr b/testsuite/tests/polykinds/T7230.stderr index 48781e8f7f..f78ccc0d61 100644 --- a/testsuite/tests/polykinds/T7230.stderr +++ b/testsuite/tests/polykinds/T7230.stderr @@ -9,13 +9,13 @@ T7230.hs:48:32: error: at T7230.hs:47:1-68 or from: xs ~ (x : xs1) bound by a pattern with constructor: - SCons :: forall a (x :: a) (xs :: [a]). + SCons :: forall {a} (x :: a) (xs :: [a]). Sing x -> Sing xs -> Sing (x : xs), in an equation for ‘crash’ at T7230.hs:48:8-27 or from: xs1 ~ (x1 : xs2) bound by a pattern with constructor: - SCons :: forall a (x :: a) (xs :: [a]). + SCons :: forall {a} (x :: a) (xs :: [a]). Sing x -> Sing xs -> Sing (x : xs), in an equation for ‘crash’ at T7230.hs:48:17-26 diff --git a/testsuite/tests/polykinds/T7438.stderr b/testsuite/tests/polykinds/T7438.stderr index 6c4eec47f2..34440d774e 100644 --- a/testsuite/tests/polykinds/T7438.stderr +++ b/testsuite/tests/polykinds/T7438.stderr @@ -4,7 +4,7 @@ T7438.hs:6:14: error: ‘p’ is untouchable inside the constraints: b ~ a bound by a pattern with constructor: - Nil :: forall k (a :: k). Thrist a a, + Nil :: forall {k} (a :: k). Thrist a a, in an equation for ‘go’ at T7438.hs:6:4-6 ‘p’ is a rigid type variable bound by diff --git a/testsuite/tests/polykinds/T7524.stderr b/testsuite/tests/polykinds/T7524.stderr index 26cfe39e8a..a158f58007 100644 --- a/testsuite/tests/polykinds/T7524.stderr +++ b/testsuite/tests/polykinds/T7524.stderr @@ -1,6 +1,6 @@ T7524.hs:5:15: error: Conflicting family instance declarations: - forall k2 (a :: k2). F a a = Int -- Defined at T7524.hs:5:15 - forall k1 k2 (a :: k1) (b :: k2). + forall {k2} {a :: k2}. F a a = Int -- Defined at T7524.hs:5:15 + forall {k1} {k2} {a :: k1} {b :: k2}. F a b = Bool -- Defined at T7524.hs:6:15 diff --git a/testsuite/tests/polykinds/T8566.stderr b/testsuite/tests/polykinds/T8566.stderr index 44fae4202e..0e4b6a8fff 100644 --- a/testsuite/tests/polykinds/T8566.stderr +++ b/testsuite/tests/polykinds/T8566.stderr @@ -6,7 +6,8 @@ T8566.hs:34:9: error: bound by the instance declaration at T8566.hs:32:10-67 or from: 'AA t (a : as) ~ 'AA t1 as1 bound by a pattern with constructor: - A :: forall v (t :: v) (as :: [U (*)]) (r :: [*]). I ('AA t as) r, + A :: forall {v} (t :: v) (as :: [U (*)]) (r :: [*]). + I ('AA t as) r, in an equation for ‘c’ at T8566.hs:34:5 The type variable ‘fs0’ is ambiguous diff --git a/testsuite/tests/polykinds/T9017.stderr b/testsuite/tests/polykinds/T9017.stderr index d9483c8490..b1d336646a 100644 --- a/testsuite/tests/polykinds/T9017.stderr +++ b/testsuite/tests/polykinds/T9017.stderr @@ -3,7 +3,7 @@ T9017.hs:8:7: error: • Couldn't match kind ‘k1’ with ‘*’ ‘k1’ is a rigid type variable bound by the type signature for: - foo :: forall k k1 (a :: k -> k1 -> *) (b :: k) (m :: k -> k1). + foo :: forall {k} {k1} (a :: k -> k1 -> *) (b :: k) (m :: k -> k1). a b (m b) at T9017.hs:7:1-16 When matching types diff --git a/testsuite/tests/polykinds/T9222.stderr b/testsuite/tests/polykinds/T9222.stderr index 94e0c16f95..1732bbc12a 100644 --- a/testsuite/tests/polykinds/T9222.stderr +++ b/testsuite/tests/polykinds/T9222.stderr @@ -8,7 +8,7 @@ T9222.hs:14:3: error: at T9222.hs:14:3-43 ‘c’ is a rigid type variable bound by the type of the constructor ‘Want’: - forall i1 j1 (a :: (i1, j1)) (b :: i1) (c :: j1). + forall {i1} {j1} (a :: (i1, j1)) (b :: i1) (c :: j1). ((a ~ '(b, c)) => Proxy b) -> Want a at T9222.hs:14:3-43 • In the ambiguity check for ‘Want’ diff --git a/testsuite/tests/printer/T14343.stderr b/testsuite/tests/printer/T14343.stderr index 7ffb689a7d..02b50eb640 100644 --- a/testsuite/tests/printer/T14343.stderr +++ b/testsuite/tests/printer/T14343.stderr @@ -7,7 +7,7 @@ T14343.hs:10:9: error: test1 :: Proxy '[ 'True] (bound at T14343.hs:10:1) Valid hole fits include test1 :: Proxy '[ 'True] (defined at T14343.hs:10:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'[ 'True] (defined at T14343.hs:8:16) @@ -19,7 +19,7 @@ T14343.hs:11:9: error: test2 :: Proxy '[ '[1]] (bound at T14343.hs:11:1) Valid hole fits include test2 :: Proxy '[ '[1]] (defined at T14343.hs:11:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'[ '[1]] (defined at T14343.hs:8:16) @@ -31,6 +31,6 @@ T14343.hs:12:9: error: test3 :: Proxy '[ '("Symbol", 1)] (bound at T14343.hs:12:1) Valid hole fits include test3 :: Proxy '[ '("Symbol", 1)] (defined at T14343.hs:12:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'[ '("Symbol", 1)] (defined at T14343.hs:8:16) diff --git a/testsuite/tests/printer/T14343b.stderr b/testsuite/tests/printer/T14343b.stderr index 94e540c79e..cc2307984c 100644 --- a/testsuite/tests/printer/T14343b.stderr +++ b/testsuite/tests/printer/T14343b.stderr @@ -7,7 +7,7 @@ T14343b.hs:10:9: error: test1 :: Proxy '( 'True, 'False) (bound at T14343b.hs:10:1) Valid hole fits include test1 :: Proxy '( 'True, 'False) (defined at T14343b.hs:10:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'( 'True, 'False) (defined at T14343b.hs:8:16) @@ -22,7 +22,7 @@ T14343b.hs:11:9: error: Valid hole fits include test2 :: Proxy '( '( 'True, 'False), 'False) (defined at T14343b.hs:11:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'( '( 'True, 'False), 'False) (defined at T14343b.hs:8:16) @@ -34,6 +34,6 @@ T14343b.hs:12:9: error: test3 :: Proxy '( '[1], 'False) (bound at T14343b.hs:12:1) Valid hole fits include test3 :: Proxy '( '[1], 'False) (defined at T14343b.hs:12:1) - Proxy :: forall k1 (k2 :: k1). Proxy k2 + Proxy :: forall {k1} (k2 :: k1). Proxy k2 with Proxy @'( '[1], 'False) (defined at T14343b.hs:8:16) diff --git a/testsuite/tests/saks/should_compile/saks025.stdout b/testsuite/tests/saks/should_compile/saks025.stdout index 3eb0cd7c30..754659518b 100644 --- a/testsuite/tests/saks/should_compile/saks025.stdout +++ b/testsuite/tests/saks/should_compile/saks025.stdout @@ -1 +1 @@ -T :: forall k j (p :: k). j -> Type -> P p -> Type +T :: forall {k} {j} (p :: k). j -> Type -> P p -> Type diff --git a/testsuite/tests/saks/should_compile/saks035.stdout b/testsuite/tests/saks/should_compile/saks035.stdout index 52193a3ff4..e52a24b69a 100644 --- a/testsuite/tests/saks/should_compile/saks035.stdout +++ b/testsuite/tests/saks/should_compile/saks035.stdout @@ -1,2 +1,2 @@ -C :: forall k (i :: k). Proxy i -> Constraint +C :: forall {k} (i :: k). Proxy i -> Constraint F :: k -> Type diff --git a/testsuite/tests/simplCore/should_compile/T13143.stderr b/testsuite/tests/simplCore/should_compile/T13143.stderr index 60345a669d..e2f9c0518f 100644 --- a/testsuite/tests/simplCore/should_compile/T13143.stderr +++ b/testsuite/tests/simplCore/should_compile/T13143.stderr @@ -6,7 +6,7 @@ Result size of Tidy Core Rec { -- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0} T13143.$wf [InlPrag=NOINLINE, Occ=LoopBreaker] - :: forall a. GHC.Prim.Void# -> a + :: forall {a}. GHC.Prim.Void# -> a [GblId, Arity=1, Str=<B,A>b, Cpr=b, Unf=OtherCon []] T13143.$wf = \ (@a) _ [Occ=Dead] -> T13143.$wf @a GHC.Prim.void# end Rec } diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr index 61892a5bbc..b74aee564e 100644 --- a/testsuite/tests/simplCore/should_compile/T7360.stderr +++ b/testsuite/tests/simplCore/should_compile/T7360.stderr @@ -40,7 +40,7 @@ T7360.fun4 :: Int T7360.fun4 = GHC.Types.I# 0# -- RHS size: {terms: 16, types: 13, coercions: 0, joins: 0/0} -fun2 :: forall a. [a] -> ((), Int) +fun2 :: forall {a}. [a] -> ((), Int) [GblId, Arity=1, Str=<L,1*U>, diff --git a/testsuite/tests/simplCore/should_compile/noinline01.stderr b/testsuite/tests/simplCore/should_compile/noinline01.stderr index 3b5a9c2919..0025a67007 100644 --- a/testsuite/tests/simplCore/should_compile/noinline01.stderr +++ b/testsuite/tests/simplCore/should_compile/noinline01.stderr @@ -1,7 +1,7 @@ ==================== STG: ==================== Noinline01.f [InlPrag=INLINE (sat-args=1)] - :: forall p. p -> GHC.Types.Bool + :: forall {p}. p -> GHC.Types.Bool [GblId, Arity=1, Str=<L,A>, Unf=OtherCon []] = \r [eta] GHC.Types.True []; diff --git a/testsuite/tests/stranal/should_compile/T15627.stderr b/testsuite/tests/stranal/should_compile/T15627.stderr index b1c5ff0738..91f51b4ba8 100644 --- a/testsuite/tests/stranal/should_compile/T15627.stderr +++ b/testsuite/tests/stranal/should_compile/T15627.stderr @@ -255,7 +255,7 @@ fac } -- RHS size: {terms: 32, types: 12, coercions: 0, joins: 1/1} -Unlifted.$wmutVar [InlPrag=NOINLINE] :: forall s a. Int# -> Int# +Unlifted.$wmutVar [InlPrag=NOINLINE] :: forall {s} {a}. Int# -> Int# [GblId, Arity=1, Caf=NoCafRefs, Str=<S,U>, Unf=OtherCon []] Unlifted.$wmutVar = \ (@ s_s2UR) (@ a_s2US) (ww_s2V0 :: Int#) -> @@ -296,7 +296,7 @@ mutVar } -- RHS size: {terms: 31, types: 10, coercions: 0, joins: 1/1} -Unlifted.$warray [InlPrag=NOINLINE] :: forall a. Int# -> Int# +Unlifted.$warray [InlPrag=NOINLINE] :: forall {a}. Int# -> Int# [GblId, Arity=1, Caf=NoCafRefs, Str=<S,U>, Unf=OtherCon []] Unlifted.$warray = \ (@ a_s2V7) (ww_s2Vf :: Int#) -> diff --git a/testsuite/tests/typecheck/should_compile/T15370.stderr b/testsuite/tests/typecheck/should_compile/T15370.stderr index f26cf92c3d..ec0ff67482 100644 --- a/testsuite/tests/typecheck/should_compile/T15370.stderr +++ b/testsuite/tests/typecheck/should_compile/T15370.stderr @@ -3,11 +3,11 @@ T15370.hs:14:10: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘n’ with ‘j’ ‘n’ is a rigid type variable bound by the type signature for: - mkRefl :: forall k (n :: k) (j :: k). n :~: j + mkRefl :: forall {k} (n :: k) (j :: k). n :~: j at T15370.hs:13:1-17 ‘j’ is a rigid type variable bound by the type signature for: - mkRefl :: forall k (n :: k) (j :: k). n :~: j + mkRefl :: forall {k} (n :: k) (j :: k). n :~: j at T15370.hs:13:1-17 Expected type: n :~: j Actual type: n :~: n diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr index bcf7dc060d..892f875f3c 100644 --- a/testsuite/tests/typecheck/should_compile/holes.stderr +++ b/testsuite/tests/typecheck/should_compile/holes.stderr @@ -7,7 +7,7 @@ holes.hs:3:5: warning: [-Wtyped-holes (in -Wdefault)] • In the expression: _ In an equation for ‘f’: f = _ • Relevant bindings include f :: t (bound at holes.hs:3:1) - Valid hole fits include f :: forall t. t + Valid hole fits include f :: forall {t}. t holes.hs:6:7: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Char @@ -17,7 +17,7 @@ holes.hs:6:7: warning: [-Wtyped-holes (in -Wdefault)] x :: Int (bound at holes.hs:6:3) g :: Int -> Char (bound at holes.hs:6:1) Valid hole fits include - f :: forall t. t + f :: forall {t}. t maxBound :: forall a. Bounded a => a minBound :: forall a. Bounded a => a @@ -29,7 +29,7 @@ holes.hs:8:5: warning: [-Wtyped-holes (in -Wdefault)] • Relevant bindings include h :: [Char] (bound at holes.hs:8:1) Valid hole fits include h :: [Char] - f :: forall t. t + f :: forall {t}. t [] :: forall a. [a] mempty :: forall a. Monoid a => a @@ -47,7 +47,7 @@ holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)] z :: [a] -> [a] g :: Int -> Char h :: [Char] - f :: forall t. t + f :: forall {t}. t otherwise :: Bool False :: Bool True :: Bool diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr index 7a8f513f25..ea1f5a6c2c 100644 --- a/testsuite/tests/typecheck/should_compile/holes3.stderr +++ b/testsuite/tests/typecheck/should_compile/holes3.stderr @@ -7,7 +7,7 @@ holes3.hs:3:5: error: • In the expression: _ In an equation for ‘f’: f = _ • Relevant bindings include f :: t (bound at holes3.hs:3:1) - Valid hole fits include f :: forall t. t + Valid hole fits include f :: forall {t}. t holes3.hs:6:7: error: • Found hole: _gr :: Char @@ -18,7 +18,7 @@ holes3.hs:6:7: error: x :: Int (bound at holes3.hs:6:3) g :: Int -> Char (bound at holes3.hs:6:1) Valid hole fits include - f :: forall t. t + f :: forall {t}. t maxBound :: forall a. Bounded a => a minBound :: forall a. Bounded a => a @@ -31,7 +31,7 @@ holes3.hs:8:5: error: • Relevant bindings include h :: [Char] (bound at holes3.hs:8:1) Valid hole fits include h :: [Char] - f :: forall t. t + f :: forall {t}. t [] :: forall a. [a] mempty :: forall a. Monoid a => a @@ -50,7 +50,7 @@ holes3.hs:11:15: error: z :: [a] -> [a] g :: Int -> Char h :: [Char] - f :: forall t. t + f :: forall {t}. t otherwise :: Bool False :: Bool True :: Bool diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index d36c58dd11..762f666153 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -3,10 +3,10 @@ tc168.hs:17:1: error: • Could not deduce (C a (a1, b0)) from the context: C a (a1, b) bound by the inferred type for ‘g’: - forall a a1 b. C a (a1, b) => a -> a1 + 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 a1 a2 b. C a1 (a2, b) => a1 -> a2 + g :: forall {a1} {a2} {b}. C a1 (a2, b) => a1 -> a2 diff --git a/testsuite/tests/typecheck/should_compile/tc231.stderr b/testsuite/tests/typecheck/should_compile/tc231.stderr index c0a0545fbc..585e6d0340 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.stderr +++ b/testsuite/tests/typecheck/should_compile/tc231.stderr @@ -1,6 +1,6 @@ TYPE SIGNATURES foo :: - forall s b chain. + forall {s} {b} {chain}. Zork s (Z [Char]) b => Q s (Z [Char]) chain -> ST s () huh :: forall s a b chain. Zork s a b => Q s a chain -> ST s () diff --git a/testsuite/tests/typecheck/should_fail/T10285.stderr b/testsuite/tests/typecheck/should_fail/T10285.stderr index 99edf39591..02215e2f70 100644 --- a/testsuite/tests/typecheck/should_fail/T10285.stderr +++ b/testsuite/tests/typecheck/should_fail/T10285.stderr @@ -3,7 +3,7 @@ T10285.hs:8:17: error: • Could not deduce: Coercible a b arising from a use of ‘coerce’ from the context: Coercible (N a) (N b) bound by a pattern with constructor: - Coercion :: forall k (a :: k) (b :: k). + Coercion :: forall {k} (a :: k) (b :: k). Coercible a b => Coercion a b, in an equation for ‘oops’ diff --git a/testsuite/tests/typecheck/should_fail/T10351.stderr b/testsuite/tests/typecheck/should_fail/T10351.stderr index 782d6e39d8..bd28a5a3e1 100644 --- a/testsuite/tests/typecheck/should_fail/T10351.stderr +++ b/testsuite/tests/typecheck/should_fail/T10351.stderr @@ -3,4 +3,4 @@ T10351.hs:6:1: error: • Non type-variable argument in the constraint: C [a] (Use FlexibleContexts to permit this) • When checking the inferred type - f :: forall a. C [a] => a -> () + f :: forall {a}. C [a] => a -> () diff --git a/testsuite/tests/typecheck/should_fail/T12785b.stderr b/testsuite/tests/typecheck/should_fail/T12785b.stderr index 44937c3c45..0a24b6ec6d 100644 --- a/testsuite/tests/typecheck/should_fail/T12785b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12785b.stderr @@ -10,7 +10,7 @@ T12785b.hs:29:63: error: at T12785b.hs:29:7-51 ‘s’ is a rigid type variable bound by a pattern with constructor: - Hide :: forall a (n :: Peano) (f :: a -> *) (s :: HTree n a). + Hide :: forall {a} (n :: Peano) (f :: a -> *) (s :: HTree n a). STree n f s -> Hidden n f, in an equation for ‘nest’ at T12785b.hs:29:7-12 diff --git a/testsuite/tests/typecheck/should_fail/T15361.stderr b/testsuite/tests/typecheck/should_fail/T15361.stderr index 93b01742ff..4b8c23ebf2 100644 --- a/testsuite/tests/typecheck/should_fail/T15361.stderr +++ b/testsuite/tests/typecheck/should_fail/T15361.stderr @@ -3,7 +3,7 @@ T15361.hs:13:13: error: • Could not deduce: a ~ c from the context: b ~ a bound by a pattern with constructor: - HRefl :: forall k1 (a :: k1). a :~~: a, + HRefl :: forall {k1} (a :: k1). a :~~: a, in an equation for ‘foo’ at T15361.hs:13:5-9 ‘a’ is a rigid type variable bound by diff --git a/testsuite/tests/typecheck/should_fail/T17773.stderr b/testsuite/tests/typecheck/should_fail/T17773.stderr index 5a6989a176..401fcc494a 100644 --- a/testsuite/tests/typecheck/should_fail/T17773.stderr +++ b/testsuite/tests/typecheck/should_fail/T17773.stderr @@ -3,7 +3,7 @@ T17773.hs:16:22: error: • Found hole: _Refl :: Mzero x y :~: (x <|> y) Where: ‘x’, ‘f’, ‘k’, ‘a’, ‘y’ are rigid type variables bound by the type signature for: - monadPlusMplus :: forall k (f :: k -> *) (a :: k) (x :: f a) + monadPlusMplus :: forall {k} (f :: k -> *) (a :: k) (x :: f a) (y :: f a). Proxy x -> Proxy y -> Mzero x y :~: (x <|> y) at T17773.hs:(13,1)-(15,41) diff --git a/testsuite/tests/typecheck/should_fail/T1897a.stderr b/testsuite/tests/typecheck/should_fail/T1897a.stderr index 61de72d6a6..2be4c938bb 100644 --- a/testsuite/tests/typecheck/should_fail/T1897a.stderr +++ b/testsuite/tests/typecheck/should_fail/T1897a.stderr @@ -3,10 +3,10 @@ T1897a.hs:9:1: error: • Could not deduce (Wob a0 b) from the context: Wob a b bound by the inferred type for ‘foo’: - forall a b. 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’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - foo :: forall a b. Wob a b => b -> [b] + foo :: forall {a} {b}. Wob a b => b -> [b] diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.stderr b/testsuite/tests/typecheck/should_fail/T6018fail.stderr index 64eba564f4..152823c80e 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018fail.stderr @@ -82,7 +82,7 @@ T6018fail.hs:68:15: error: Type family equation violates the family's injectivity annotation. Type/kind variable ‘k’ cannot be inferred from the right-hand side. In the type family equation: - forall k (a :: k) (b :: k). + forall {k} {a :: k} {b :: k}. Fc @k a b = Int -- Defined at T6018fail.hs:68:15 T6018fail.hs:72:15: error: @@ -90,7 +90,7 @@ T6018fail.hs:72:15: error: Type/kind variables ‘k’, ‘a’, ‘b’ cannot be inferred from the right-hand side. In the type family equation: - forall k (a :: k) (b :: k). + forall {k} {a :: k} {b :: k}. Gc @k a b = Int -- Defined at T6018fail.hs:72:15 T6018fail.hs:76:15: error: @@ -151,7 +151,7 @@ T6018fail.hs:120:15: error: Type/kind variables ‘k’, ‘c’ cannot be inferred from the right-hand side. In the type family equation: - forall k a b (c :: k). + forall {k} {a} {b} {c :: k}. G7 @k a b c = [G7a @k a b c] -- Defined at T6018fail.hs:120:15 T6018fail.hs:131:1: error: diff --git a/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr b/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr index 32bcf83ba5..50df2777ce 100644 --- a/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr @@ -28,7 +28,7 @@ T6018failclosed.hs:25:5: error: Type/kind variables ‘k1’, ‘b’ cannot be inferred from the right-hand side. In the type family equation: - forall k1 k2 (b :: k1) (c :: k2). + forall {k1} {k2} {b :: k1} {c :: k2}. JClosed @{k1} @{k2} Int b c = Char -- Defined at T6018failclosed.hs:25:5 • In the equations for closed type family ‘JClosed’ @@ -45,7 +45,7 @@ T6018failclosed.hs:30:5: error: T6018failclosed.hs:35:5: error: • Type family equation violates the family's injectivity annotation. RHS of injective type family equation cannot be a type family: - forall k (a :: k). + forall {k} {a :: k}. LClosed a = MaybeSynClosed a -- Defined at T6018failclosed.hs:35:5 • In the equations for closed type family ‘LClosed’ In the type family declaration for ‘LClosed’ @@ -94,7 +94,7 @@ T6018failclosed.hs:66:5: error: • Type family equation violates the family's injectivity annotation. Type/kind variable ‘k’ cannot be inferred from the right-hand side. In the type family equation: - forall k (a :: k) (b :: k). + forall {k} {a :: k} {b :: k}. Gc @k a b = Int -- Defined at T6018failclosed.hs:66:5 • In the equations for closed type family ‘Gc’ In the type family declaration for ‘Gc’ diff --git a/testsuite/tests/typecheck/should_fail/T6022.stderr b/testsuite/tests/typecheck/should_fail/T6022.stderr index e690095665..6423925b12 100644 --- a/testsuite/tests/typecheck/should_fail/T6022.stderr +++ b/testsuite/tests/typecheck/should_fail/T6022.stderr @@ -3,4 +3,4 @@ T6022.hs:3:1: error: • Non type-variable argument in the constraint: Eq ([a] -> a) (Use FlexibleContexts to permit this) • When checking the inferred type - f :: forall a. Eq ([a] -> a) => ([a] -> a) -> Bool + f :: forall {a}. Eq ([a] -> a) => ([a] -> a) -> Bool diff --git a/testsuite/tests/typecheck/should_fail/T7453.stderr b/testsuite/tests/typecheck/should_fail/T7453.stderr index d72b6d9a7a..224f5b90fe 100644 --- a/testsuite/tests/typecheck/should_fail/T7453.stderr +++ b/testsuite/tests/typecheck/should_fail/T7453.stderr @@ -58,7 +58,7 @@ T7453.hs:21:15: error: where aux = const v • Relevant bindings include - aux :: forall b. b -> p (bound at T7453.hs:22:21) + aux :: forall {b}. b -> p (bound at T7453.hs:22:21) z :: t1 (bound at T7453.hs:21:11) v :: p (bound at T7453.hs:19:7) cast3 :: p -> t (bound at T7453.hs:19:1) diff --git a/testsuite/tests/typecheck/should_fail/T8883.stderr b/testsuite/tests/typecheck/should_fail/T8883.stderr index d5a547db7b..c56c434c4c 100644 --- a/testsuite/tests/typecheck/should_fail/T8883.stderr +++ b/testsuite/tests/typecheck/should_fail/T8883.stderr @@ -3,6 +3,6 @@ T8883.hs:20:1: error: • Non type-variable argument in the constraint: Functor (PF a) (Use FlexibleContexts to permit this) • When checking the inferred type - fold :: forall a b. + fold :: forall {a} {b}. (Functor (PF a), Regular a) => (PF a b -> b) -> a -> b diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesCoerceFail.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesCoerceFail.stderr index 638dc80ff8..1c39c9133b 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesCoerceFail.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesCoerceFail.stderr @@ -1,5 +1,8 @@ -UnliftedNewtypesCoerceFail.hs:15:8: + +UnliftedNewtypesCoerceFail.hs:15:8: error: Cannot use function with levity-polymorphic arguments: coerce :: x -> y + (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples + are eta-expanded internally because they must occur fully saturated. + Use -fprint-typechecker-elaboration to display the full expression.) Levity-polymorphic arguments: x :: TYPE rep - diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesLevityBinder.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesLevityBinder.stderr index 90cf5b23aa..70746fd60a 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesLevityBinder.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesLevityBinder.stderr @@ -1,4 +1,8 @@ -UnliftedNewtypesLevityBinder.hs:16:7: + +UnliftedNewtypesLevityBinder.hs:16:7: error: Cannot use function with levity-polymorphic arguments: - UnliftedNewtypesLevityBinder.IdentC :: a -> Ident a + IdentC :: a -> Ident a + (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples + are eta-expanded internally because they must occur fully saturated. + Use -fprint-typechecker-elaboration to display the full expression.) Levity-polymorphic arguments: a :: TYPE r diff --git a/testsuite/tests/typecheck/should_fail/tcfail080.stderr b/testsuite/tests/typecheck/should_fail/tcfail080.stderr index 2fd7240182..c6d7fc5c90 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail080.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail080.stderr @@ -3,10 +3,10 @@ tcfail080.hs:27:1: error: • Could not deduce (Collection c0 a) from the context: Collection c a bound by the inferred type for ‘q’: - forall (c :: * -> *) a. 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’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - q :: forall (c :: * -> *) a. Collection c a => a -> Bool + q :: forall {c :: * -> *} {a}. Collection c a => a -> Bool diff --git a/testsuite/tests/warnings/should_compile/T12574.stderr b/testsuite/tests/warnings/should_compile/T12574.stderr index db435541c1..35427c1b90 100644 --- a/testsuite/tests/warnings/should_compile/T12574.stderr +++ b/testsuite/tests/warnings/should_compile/T12574.stderr @@ -1,4 +1,4 @@ T12574.hs:3:1: warning: [-Wmissing-local-signatures] Polymorphic local binding with no type signature: - T12574.id :: forall p. p -> p + T12574.id :: forall {p}. p -> p |