diff options
64 files changed, 532 insertions, 384 deletions
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 58c0e21819..b0a9d4966d 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -902,7 +902,7 @@ interface file. One such example is inferred type signatures. They also affect the results of optimizations, for example worker-wrapper. This means that to get deterministic builds quantifyTyVars needs to be deterministic. -To achieve this TcDepVars is backed by deterministic sets which allows them +To achieve this CandidatesQTvs is backed by deterministic sets which allows them to be later converted to a list in a deterministic order. For more information about deterministic sets see @@ -910,8 +910,8 @@ Note [Deterministic UniqFM] in UniqDFM. -} quantifyTyVars, quantifyZonkedTyVars - :: TcTyCoVarSet -- global tvs - -> TcDepVars -- See Note [Dependent type variables] in TcType + :: TcTyCoVarSet -- global tvs + -> CandidatesQTvs -- See Note [Dependent type variables] in TcType -> TcM [TcTyVar] -- See Note [quantifyTyVars] -- Can be given a mixture of TcTyVars and TyVars, in the case of @@ -1257,15 +1257,15 @@ zonkTcTypeAndFV :: TcType -> TcM DTyCoVarSet zonkTcTypeAndFV ty = tyCoVarsOfTypeDSet <$> zonkTcTypeInKnot ty --- | Zonk a type and call 'splitDepVarsOfType' on it. +-- | Zonk a type and call 'candidateQTyVarsOfType' on it. -- Works within the knot. -zonkTcTypeAndSplitDepVars :: TcType -> TcM TcDepVars +zonkTcTypeAndSplitDepVars :: TcType -> TcM CandidatesQTvs zonkTcTypeAndSplitDepVars ty - = splitDepVarsOfType <$> zonkTcTypeInKnot ty + = candidateQTyVarsOfType <$> zonkTcTypeInKnot ty -zonkTcTypesAndSplitDepVars :: [TcType] -> TcM TcDepVars +zonkTcTypesAndSplitDepVars :: [TcType] -> TcM CandidatesQTvs zonkTcTypesAndSplitDepVars tys - = splitDepVarsOfTypes <$> mapM zonkTcTypeInKnot tys + = candidateQTyVarsOfTypes <$> mapM zonkTcTypeInKnot tys zonkTyCoVar :: TyCoVar -> TcM TcType -- Works on TyVars and TcTyVars diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 73398a8e76..4402d8f4de 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -808,17 +808,14 @@ decideQuantification :: InferMode -> [(Name, TcTauType)] -- Variables to be generalised -> [PredType] -- All annotated constraints from signatures - -> [PredType] -- Candidate theta + -> [PredType] -- Candidate theta; already zonked -> TcM ( [TcTyVar] -- Quantify over these (skolems) , [PredType] ) -- and this context (fully zonked) -- See Note [Deciding quantification] decideQuantification infer_mode name_taus psig_theta candidates - = do { gbl_tvs <- tcGetGlobalTyCoVars - ; zonked_taus <- mapM TcM.zonkTcType (psig_theta ++ taus) - -- psig_theta: see Note [Quantification and partial signatures] - ; ovl_strings <- xoptM LangExt.OverloadedStrings - ; let DV {dv_kvs = zkvs, dv_tvs = ztvs} = splitDepVarsOfTypes zonked_taus - (gbl_cand, quant_cand) -- gbl_cand = do not quantify me + = do { ovl_strings <- xoptM LangExt.OverloadedStrings + ; gbl_tvs <- tcGetGlobalTyCoVars + ; let (gbl_cand, quant_cand) -- gbl_cand = do not quantify me = case infer_mode of -- quant_cand = try to quantify me ApplyMR -> (candidates, []) NoRestrictions -> ([], candidates) @@ -834,8 +831,20 @@ decideQuantification infer_mode name_taus psig_theta candidates constrained_tvs = tyCoVarsOfTypes gbl_cand mono_tvs = growThetaTyVars eq_constraints $ gbl_tvs `unionVarSet` constrained_tvs - tau_tvs_plus = growThetaTyVarsDSet quant_cand ztvs - dvs_plus = DV { dv_kvs = zkvs, dv_tvs = tau_tvs_plus } + + ; zonked_taus <- mapM TcM.zonkTcType (psig_theta ++ taus) + -- psig_theta: see Note [Quantification and partial signatures] + + ; let -- The candidate tyvars are the ones free in + -- either quant_cand or zonked_taus. + DV {dv_kvs = cand_kvs, dv_tvs = cand_tvs} + = candidateQTyVarsOfTypes (quant_cand ++ zonked_taus) + + -- Now keep only the ones reachable + -- (via growThetaTyVars) from zonked_taus. + grown_tvs = growThetaTyVars quant_cand (tyCoVarsOfTypes zonked_taus) + pick = filterDVarSet (`elemVarSet` grown_tvs) + dvs_plus = DV { dv_kvs = pick cand_kvs, dv_tvs = pick cand_tvs } ; qtvs <- quantifyZonkedTyVars mono_tvs dvs_plus -- We don't grow the kvs, as there's no real need to. Recall @@ -855,7 +864,7 @@ decideQuantification infer_mode name_taus psig_theta candidates -- Warn about the monomorphism restriction ; warn_mono <- woptM Opt_WarnMonomorphism ; let mr_bites | ApplyMR <- infer_mode - = constrained_tvs `intersectsVarSet` tcDepVarSet dvs_plus + = constrained_tvs `intersectsVarSet` grown_tvs | otherwise = False ; warnTc (Reason Opt_WarnMonomorphism) (warn_mono && mr_bites) $ @@ -871,7 +880,8 @@ decideQuantification infer_mode name_taus psig_theta candidates , text "quant_cand:" <+> ppr quant_cand , text "gbl_tvs:" <+> ppr gbl_tvs , text "mono_tvs:" <+> ppr mono_tvs - , text "tau_tvs_plus:" <+> ppr tau_tvs_plus + , text "cand_tvs" <+> ppr cand_tvs + , text "grown_tvs:" <+> ppr grown_tvs , text "qtvs:" <+> ppr qtvs , text "min_theta:" <+> ppr min_theta ]) ; return (qtvs, min_theta) } @@ -901,32 +911,6 @@ growThetaTyVars theta tvs where pred_tvs = tyCoVarsOfType pred ------------------- -growThetaTyVarsDSet :: ThetaType -> DTyCoVarSet -> DTyVarSet --- See Note [Growing the tau-tvs using constraints] --- NB: only returns tyvars, never covars --- It takes a deterministic set of TyCoVars and returns a deterministic set --- of TyVars. --- The implementation mirrors growThetaTyVars, the only difference is that --- it avoids unionDVarSet and uses more efficient extendDVarSetList. -growThetaTyVarsDSet theta tvs - | null theta = tvs_only - | otherwise = filterDVarSet isTyVar $ - transCloDVarSet mk_next seed_tvs - where - tvs_only = filterDVarSet isTyVar tvs - seed_tvs = tvs `extendDVarSetList` tyCoVarsOfTypesList ips - (ips, non_ips) = partition isIPPred theta - -- See Note [Inheriting implicit parameters] in TcType - - mk_next :: DVarSet -> DVarSet -- Maps current set to newly-grown ones - mk_next so_far = foldr (grow_one so_far) emptyDVarSet non_ips - grow_one so_far pred tvs - | any (`elemDVarSet` so_far) pred_tvs = tvs `extendDVarSetList` pred_tvs - | otherwise = tvs - where - pred_tvs = tyCoVarsOfTypeList pred - {- Note [Quantification and partial signatures] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When choosing type variables to quantify, the basic plan is to diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 69d1f7c60c..6a4a989fe9 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -103,7 +103,7 @@ module TcType ( -- * Finding "exact" (non-dead) type variables exactTyCoVarsOfType, exactTyCoVarsOfTypes, - splitDepVarsOfType, splitDepVarsOfTypes, TcDepVars(..), tcDepVarSet, + candidateQTyVarsOfType, candidateQTyVarsOfTypes, CandidatesQTvs(..), anyRewritableTyVar, -- * Extracting bound variables @@ -956,8 +956,8 @@ allBoundVariabless = mapUnionVarSet allBoundVariables * * ********************************************************************* -} -data TcDepVars -- See Note [Dependent type variables] - -- See Note [TcDepVars determinism] +data CandidatesQTvs -- See Note [Dependent type variables] + -- See Note [CandidatesQTvs determinism] = DV { dv_kvs :: DTyCoVarSet -- "kind" variables (dependent) , dv_tvs :: DTyVarSet -- "type" variables (non-dependent) -- A variable may appear in both sets @@ -966,19 +966,14 @@ data TcDepVars -- See Note [Dependent type variables] -- See Note [Dependent type variables] } -tcDepVarSet :: TcDepVars -> TyVarSet --- Actually can contain CoVars, but never mind -tcDepVarSet (DV { dv_kvs = kvs, dv_tvs = tvs }) - = dVarSetToVarSet kvs `unionVarSet` dVarSetToVarSet tvs - -instance Monoid TcDepVars where +instance Monoid CandidatesQTvs where mempty = DV { dv_kvs = emptyDVarSet, dv_tvs = emptyDVarSet } mappend (DV { dv_kvs = kv1, dv_tvs = tv1 }) (DV { dv_kvs = kv2, dv_tvs = tv2 }) = DV { dv_kvs = kv1 `unionDVarSet` kv2 , dv_tvs = tv1 `unionDVarSet` tv2} -instance Outputable TcDepVars where +instance Outputable CandidatesQTvs where ppr (DV {dv_kvs = kvs, dv_tvs = tvs }) = text "DV" <+> braces (sep [ text "dv_kvs =" <+> ppr kvs , text "dv_tvs =" <+> ppr tvs ]) @@ -986,15 +981,22 @@ instance Outputable TcDepVars where {- Note [Dependent type variables] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Haskell type inference we quantify over type variables; but we only -quantify over /kind/ variables when -XPolyKinds is on. So when +quantify over /kind/ variables when -XPolyKinds is on. Without -XPolyKinds +we default the kind variables to *. + +So, to support this defaulting, and only for that reason, when collecting the free vars of a type, prior to quantifying, we must keep -the type and kind variables separate. But what does that mean in a -system where kind variables /are/ type variables? It's a fairly -arbitrary distinction based on how the variables appear: +the type and kind variables separate. + +But what does that mean in a system where kind variables /are/ type +variables? It's a fairly arbitrary distinction based on how the +variables appear: - "Kind variables" appear in the kind of some other free variable PLUS any free coercion variables + These are the ones we default to * if -XPolyKinds is off + - "Type variables" are all free vars that are not kind variables E.g. In the type T k (a::k) @@ -1002,7 +1004,7 @@ E.g. In the type T k (a::k) even though it also appears at "top level" of the type 'a' is a type variable, because it doesn't -We gather these variables using a TcDepVars record: +We gather these variables using a CandidatesQTvs record: DV { dv_kvs: Variables free in the kind of a free type variable or of a forall-bound type variable , dv_tvs: Variables sytactically free in the type } @@ -1026,48 +1028,69 @@ Note that The "type variables" do not depend on each other; if one did, it'd be classified as a kind variable! -Note [TcDepVars determinism] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When we quantify over type variables we decide the order in which they -appear in the final type. Because the order of type variables in the type -can end up in the interface file and affects some optimizations like -worker-wrapper we want this order to be deterministic. - -To achieve that we use deterministic sets of variables that can be converted to -lists in a deterministic order. - -For more information about deterministic sets see -Note [Deterministic UniqFM] in UniqDFM. +Note [CandidatesQTvs determinism and order] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Determinism: when we quantify over type variables we decide the + order in which they appear in the final type. Because the order of + type variables in the type can end up in the interface file and + affects some optimizations like worker-wrapper, we want this order to + be deterministic. + + To achieve that we use deterministic sets of variables that can be + converted to lists in a deterministic order. For more information + about deterministic sets see Note [Deterministic UniqFM] in UniqDFM. + +* Order: as well as being deterministic, we use an + accumulating-parameter style for candidateQTyVarsOfType so that we + add variables one at a time, left to right. That means we tend to + produce the variables in left-to-right order. This is just to make + it bit more predicatable for the programmer. -} --- | Like 'splitDepVarsOfType', but over a list of types -splitDepVarsOfTypes :: [Type] -> TcDepVars -splitDepVarsOfTypes = foldMap splitDepVarsOfType - -- | Worker for 'splitDepVarsOfType'. This might output the same var -- in both sets, if it's used in both a type and a kind. --- See Note [TcDepVars determinism] +-- See Note [CandidatesQTvs determinism and order] -- See Note [Dependent type variables] -splitDepVarsOfType :: Type -> TcDepVars -splitDepVarsOfType = go +candidateQTyVarsOfType :: Type -> CandidatesQTvs +candidateQTyVarsOfType = split_dvs emptyVarSet mempty + +split_dvs :: VarSet -> CandidatesQTvs -> Type -> CandidatesQTvs +split_dvs bound dvs ty + = go dvs ty where - go (TyVarTy tv) = DV { dv_kvs =tyCoVarsOfTypeDSet $ tyVarKind tv - , dv_tvs = unitDVarSet tv } - go (AppTy t1 t2) = go t1 `mappend` go t2 - go (TyConApp _ tys) = foldMap go tys - go (FunTy arg res) = go arg `mappend` go res - go (LitTy {}) = mempty - go (CastTy ty co) = go ty `mappend` go_co co - go (CoercionTy co) = go_co co - go (ForAllTy (TvBndr tv _) ty) - = let DV { dv_kvs = kvs, dv_tvs = tvs } = go ty in - DV { dv_kvs = (kvs `delDVarSet` tv) - `extendDVarSetList` tyCoVarsOfTypeList (tyVarKind tv) - , dv_tvs = tvs `delDVarSet` tv } - - go_co co = DV { dv_kvs = tyCoVarsOfCoDSet co + go dv (AppTy t1 t2) = go (go dv t1) t2 + go dv (TyConApp _ tys) = foldl go dv tys + go dv (FunTy arg res) = go (go dv arg) res + go dv (LitTy {}) = dv + go dv (CastTy ty co) = go dv ty `mappend` go_co co + go dv (CoercionTy co) = dv `mappend` go_co co + + go dv@(DV { dv_kvs = kvs, dv_tvs = tvs }) (TyVarTy tv) + | tv `elemVarSet` bound + = dv + | otherwise + = DV { dv_kvs = kvs `unionDVarSet` + kill_bound (tyCoVarsOfTypeDSet (tyVarKind tv)) + , dv_tvs = tvs `extendDVarSet` tv } + + go dv (ForAllTy (TvBndr tv _) ty) + = DV { dv_kvs = kvs `unionDVarSet` + kill_bound (tyCoVarsOfTypeDSet (tyVarKind tv)) + , dv_tvs = tvs } + where + DV { dv_kvs = kvs, dv_tvs = tvs } = split_dvs (bound `extendVarSet` tv) dv ty + + go_co co = DV { dv_kvs = kill_bound (tyCoVarsOfCoDSet co) , dv_tvs = emptyDVarSet } + kill_bound free + | isEmptyVarSet bound = free + | otherwise = filterDVarSet (not . (`elemVarSet` bound)) free + +-- | Like 'splitDepVarsOfType', but over a list of types +candidateQTyVarsOfTypes :: [Type] -> CandidatesQTvs +candidateQTyVarsOfTypes = foldl (split_dvs emptyVarSet) mempty + {- ************************************************************************ * * diff --git a/compiler/utils/UniqDFM.hs b/compiler/utils/UniqDFM.hs index 10e8aa94d2..9f81e4dca6 100644 --- a/compiler/utils/UniqDFM.hs +++ b/compiler/utils/UniqDFM.hs @@ -143,34 +143,40 @@ unitUDFM :: Uniquable key => key -> elt -> UniqDFM elt unitUDFM k v = UDFM (M.singleton (getKey $ getUnique k) (TaggedVal v 0)) 1 addToUDFM :: Uniquable key => UniqDFM elt -> key -> elt -> UniqDFM elt -addToUDFM (UDFM m i) k v = - UDFM (M.insert (getKey $ getUnique k) (TaggedVal v i) m) (i + 1) +addToUDFM m k v = addToUDFM_Directly m (getUnique k) v addToUDFM_Directly :: UniqDFM elt -> Unique -> elt -> UniqDFM elt -addToUDFM_Directly (UDFM m i) u v = - UDFM (M.insert (getKey u) (TaggedVal v i) m) (i + 1) - -addToUDFM_Directly_C - :: (elt -> elt -> elt) -> UniqDFM elt -> Unique -> elt -> UniqDFM elt -addToUDFM_Directly_C f (UDFM m i) u v = - UDFM (M.insertWith tf (getKey u) (TaggedVal v i) m) (i + 1) +addToUDFM_Directly (UDFM m i) u v + = UDFM (M.insertWith tf (getKey u) (TaggedVal v i) m) (i + 1) where - tf (TaggedVal a j) (TaggedVal b _) = TaggedVal (f a b) j + tf (TaggedVal new_v _) (TaggedVal _ old_i) = TaggedVal new_v old_i + -- Keep the old tag, but insert the new value + -- This means that udfmToList typically returns elements + -- in the order of insertion, rather than the reverse -addListToUDFM :: Uniquable key => UniqDFM elt -> [(key,elt)] -> UniqDFM elt -addListToUDFM = foldl (\m (k, v) -> addToUDFM m k v) +addToUDFM_Directly_C + :: (elt -> elt -> elt) -- old -> new -> result + -> UniqDFM elt + -> Unique -> elt + -> UniqDFM elt +addToUDFM_Directly_C f (UDFM m i) u v + = UDFM (M.insertWith tf (getKey u) (TaggedVal v i) m) (i + 1) + where + tf (TaggedVal new_v _) (TaggedVal old_v old_i) + = TaggedVal (f old_v new_v) old_i + -- Flip the arguments, because M.insertWith uses (new->old->result) + -- but f needs (old->new->result) + -- Like addToUDFM_Directly, keep the old tag addToUDFM_C :: Uniquable key => (elt -> elt -> elt) -- old -> new -> result -> UniqDFM elt -- old -> key -> elt -- new -> UniqDFM elt -- result -addToUDFM_C f (UDFM m i) k v = - UDFM (M.insertWith tf (getKey $ getUnique k) (TaggedVal v i) m) (i + 1) - where - tf (TaggedVal a j) (TaggedVal b _) = TaggedVal (f b a) j - -- Flip the arguments, just like - -- addToUFM_C does. +addToUDFM_C f m k v = addToUDFM_Directly_C f m (getUnique k) v + +addListToUDFM :: Uniquable key => UniqDFM elt -> [(key,elt)] -> UniqDFM elt +addListToUDFM = foldl (\m (k, v) -> addToUDFM m k v) addListToUDFM_Directly :: UniqDFM elt -> [(Unique,elt)] -> UniqDFM elt addListToUDFM_Directly = foldl (\m (k, v) -> addToUDFM_Directly m k v) diff --git a/libraries/array b/libraries/array -Subproject c58ecfadbe68486e9eab925c9c44d667316b2d1 +Subproject 1b9a4430bbd6799f341a829f2d24ffc20e77ba2 diff --git a/testsuite/tests/ado/ado004.stderr b/testsuite/tests/ado/ado004.stderr index 531cb5f9b3..104e223145 100644 --- a/testsuite/tests/ado/ado004.stderr +++ b/testsuite/tests/ado/ado004.stderr @@ -4,33 +4,33 @@ TYPE SIGNATURES test1a :: forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int test2 :: - forall t b (f :: * -> *). + forall (f :: * -> *) t b. (Num b, Num t, Applicative f) => (t -> f b) -> f b test2a :: - forall t b (f :: * -> *). + forall (f :: * -> *) t b. (Num b, Num t, Functor f) => (t -> f b) -> f b test2b :: - forall (m :: * -> *) a t. (Num t, Monad m) => (t -> a) -> m a + forall (m :: * -> *) t a. (Num t, Monad m) => (t -> a) -> m a test2c :: - forall t b (f :: * -> *). + forall (f :: * -> *) t b. (Num b, Num t, Functor f) => (t -> f b) -> f b test3 :: - forall a t1 (m :: * -> *) t2. - (Num t2, Monad m) => - (t2 -> m t1) -> (t1 -> t1 -> m a) -> m a + forall (m :: * -> *) t1 t2 a. + (Num t1, Monad m) => + (t1 -> m t2) -> (t2 -> t2 -> m a) -> m a test4 :: - forall a1 a2 (m :: * -> *) t. + forall (m :: * -> *) t a1 a2. (Num t, Monad m) => - (t -> m a2) -> (a2 -> a2 -> m a1) -> m a1 + (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test5 :: - forall a1 a2 (m :: * -> *) t. + forall (m :: * -> *) t a1 a2. (Num t, Monad m) => - (t -> m a2) -> (a2 -> a2 -> m a1) -> m a1 + (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test6 :: - forall a (m :: * -> *) p. + forall (m :: * -> *) a p. (Num (m a), Monad m) => (m a -> m (m a)) -> p -> m a TYPE CONSTRUCTORS diff --git a/testsuite/tests/determinism/determ021/determ021.stdout b/testsuite/tests/determinism/determ021/determ021.stdout index 54b795d55d..bc5b5cd8a3 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 t b (f :: * -> *). + forall (f :: * -> *) t b. (Num b, Num t, Applicative f) => (t -> f b) -> f b TYPE CONSTRUCTORS @@ -12,7 +12,7 @@ Dependent packages: [base-4.10.0.0, ghc-prim-0.5.0.0, [1 of 1] Compiling A ( A.hs, A.o ) TYPE SIGNATURES test2 :: - forall t b (f :: * -> *). + forall (f :: * -> *) t b. (Num b, Num t, Applicative f) => (t -> f b) -> f b TYPE CONSTRUCTORS diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index 9d8d7248ed..ccbeb393cd 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -17,7 +17,7 @@ werror.hs:10:1: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)] Defined but not used: ‘f’ werror.hs:10:1: warning: [-Wmissing-signatures (in -Wall)] - Top-level binding with no type signature: f :: [a2] -> [a1] + Top-level binding with no type signature: f :: [a1] -> [a2] werror.hs:10:1: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive diff --git a/testsuite/tests/gadt/gadt7.stderr b/testsuite/tests/gadt/gadt7.stderr index 7678a6ab07..ea9033ac6c 100644 --- a/testsuite/tests/gadt/gadt7.stderr +++ b/testsuite/tests/gadt/gadt7.stderr @@ -1,20 +1,20 @@ gadt7.hs:16:38: error: - • Couldn't match expected type ‘p’ with actual type ‘p1’ - ‘p’ is untouchable + • Couldn't match expected type ‘p1’ with actual type ‘p’ + ‘p1’ is untouchable inside the constraints: a ~ Int bound by a pattern with constructor: K :: T Int, in a case alternative at gadt7.hs:16:33 - ‘p’ is a rigid type variable bound by - the inferred type of i1b :: T a -> p1 -> p at gadt7.hs:16:1-44 ‘p1’ is a rigid type variable bound by - the inferred type of i1b :: T a -> p1 -> p at gadt7.hs:16:1-44 + the inferred type of i1b :: T a -> p -> p1 at gadt7.hs:16:1-44 + ‘p’ is a rigid type variable bound by + the inferred type of i1b :: T a -> p -> p1 at gadt7.hs:16:1-44 Possible fix: add a type signature for ‘i1b’ • In the expression: y1 In a case alternative: K -> y1 In the expression: case t1 of { K -> y1 } • Relevant bindings include - y1 :: p1 (bound at gadt7.hs:16:16) - y :: p1 (bound at gadt7.hs:16:7) - i1b :: T a -> p1 -> p (bound at gadt7.hs:16:1) + y1 :: p (bound at gadt7.hs:16:16) + y :: p (bound at gadt7.hs:16:7) + i1b :: T a -> p -> p1 (bound at gadt7.hs:16:1) diff --git a/testsuite/tests/ghci.debugger/scripts/break026.stdout b/testsuite/tests/ghci.debugger/scripts/break026.stdout index 260ef49124..90c1f2ee9e 100644 --- a/testsuite/tests/ghci.debugger/scripts/break026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break026.stdout @@ -1,8 +1,8 @@ Stopped in Test.foldl, break026.hs:5:16-22 _result :: Integer = _ c :: Integer = 0 -go :: Integer -> [t] -> Integer = _ -xs :: [t] = _ +go :: Integer -> [t1] -> Integer = _ +xs :: [t1] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 _result :: Integer = _ c :: Integer = 0 @@ -10,17 +10,17 @@ f :: Integer -> Integer -> Integer = _ x :: Integer = 1 xs :: [Integer] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 -_result :: t1 = _ -c :: t1 = _ -f :: t1 -> Integer -> t1 = _ +_result :: t = _ +c :: t = _ +f :: t -> Integer -> t = _ x :: Integer = 2 xs :: [Integer] = _ c = 1 Stopped in Test.foldl, break026.hs:5:16-22 _result :: Integer = _ c :: Integer = 0 -go :: Integer -> [t] -> Integer = _ -xs :: [t] = _ +go :: Integer -> [t1] -> Integer = _ +xs :: [t1] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 _result :: Integer = _ c :: Integer = 0 @@ -28,9 +28,9 @@ f :: Integer -> Integer -> Integer = _ x :: Integer = 1 xs :: [Integer] = _ Stopped in Test.foldl.go, break026.hs:7:23-35 -_result :: t1 = _ -c :: t1 = _ -f :: t1 -> Integer -> t1 = _ +_result :: t = _ +c :: t = _ +f :: t -> Integer -> t = _ x :: Integer = 2 xs :: [Integer] = _ Stopped in Test.foldl.go, break026.hs:7:27-31 diff --git a/testsuite/tests/ghci/scripts/T11524a.stdout b/testsuite/tests/ghci/scripts/T11524a.stdout index 27122574e9..007d2ae097 100644 --- a/testsuite/tests/ghci/scripts/T11524a.stdout +++ b/testsuite/tests/ghci/scripts/T11524a.stdout @@ -6,8 +6,8 @@ pattern Pu :: p -> p -- Defined at <interactive>:18:1 pattern Pue :: a -> a1 -> (a, Ex) -- Defined at <interactive>:19:1 pattern Pur :: (Num a, Eq a) => a -> [a] -- Defined at <interactive>:20:1 -pattern Purp :: (Num a1, Eq a1) => Show a => a1 - -> a -> ([a1], UnivProv a) +pattern Purp :: (Num a, Eq a) => Show a1 => a + -> a1 -> ([a], UnivProv a1) -- Defined at <interactive>:21:1 pattern Pure :: (Num a, Eq a) => a -> a1 -> ([a], Ex) -- Defined at <interactive>:22:1 @@ -31,8 +31,8 @@ pattern Pue :: forall {a}. () => forall {a1}. a -> a1 -> (a, Ex) -- Defined at <interactive>:19:1 pattern Pur :: forall {a}. (Num a, Eq a) => a -> [a] -- Defined at <interactive>:20:1 -pattern Purp :: forall {a} {a1}. (Num a1, Eq a1) => Show a => a1 - -> a -> ([a1], UnivProv a) +pattern Purp :: forall {a} {a1}. (Num a, Eq a) => Show a1 => a + -> a1 -> ([a], UnivProv a1) -- Defined at <interactive>:21:1 pattern Pure :: forall {a}. (Num a, Eq a) => forall {a1}. a -> a1 -> ([a], Ex) diff --git a/testsuite/tests/ghci/scripts/T11975.stdout b/testsuite/tests/ghci/scripts/T11975.stdout index 23adaf02db..1a3dd4341a 100644 --- a/testsuite/tests/ghci/scripts/T11975.stdout +++ b/testsuite/tests/ghci/scripts/T11975.stdout @@ -1,5 +1,5 @@ mapM - :: forall {t :: * -> *} {b} {m :: * -> *} {a}. + :: forall {t :: * -> *} {m :: * -> *} {a} {b}. (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b) mapM diff --git a/testsuite/tests/ghci/scripts/T12550.stdout b/testsuite/tests/ghci/scripts/T12550.stdout index de3f8d15d6..d4ac6b86fb 100644 --- a/testsuite/tests/ghci/scripts/T12550.stdout +++ b/testsuite/tests/ghci/scripts/T12550.stdout @@ -1,16 +1,16 @@ -f :: forall {b} {a :: * -> *}. C a => a b -f :: forall {b} {a :: * -> *}. C a => a b -f :: forall {b} {a :: * -> *}. C a => a b -f :: forall {b} {a :: * -> *}. C a => a b -f :: forall {b} {a :: * -> *}. C a => a b -f :: forall {b} {a :: * -> *}. C a => a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -f ∷ ∀ {b} {a ∷ ★ → ★}. C a ⇒ a b -fmap ∷ ∀ {f ∷ ★ → ★} {b} {a}. Functor f ⇒ (a → b) → f a → f b +f :: forall {a :: * -> *} {b}. C a => a b +f :: forall {a :: * -> *} {b}. C a => a b +f :: forall {a :: * -> *} {b}. C a => a b +f :: forall {a :: * -> *} {b}. C a => a b +f :: forall {a :: * -> *} {b}. C a => a b +f :: forall {a :: * -> *} {b}. C a => a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b +fmap ∷ ∀ {f ∷ ★ → ★} {a} {b}. Functor f ⇒ (a → b) → f a → f b class Functor (f ∷ ★ → ★) where fmap ∷ ∀ a b. (a → b) → f a → f b ... @@ -62,6 +62,6 @@ class Datatype (d ∷ k) where t d f a → [Char] ... -- Defined in ‘GHC.Generics’ -(:*:) ∷ ∀ {g ∷ ★ → ★} {p} {f ∷ ★ → ★}. f p → g p → (:*:) f g p +(:*:) ∷ ∀ {f ∷ ★ → ★} {p} {g ∷ ★ → ★}. f p → g p → (:*:) f g p Rep ∷ ★ → ★ → ★ M1 ∷ ∀ k. ★ → Meta → (k → ★) → k → ★ diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 994886cc4a..fff1b150e5 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -4,8 +4,8 @@ type instance A Int Int = () -- Defined at T4175.hs:8:15 type instance A (B a) b = () -- Defined at T4175.hs:10:15 data family B a -- Defined at T4175.hs:12:1 instance G B -- Defined at T4175.hs:34:10 -data instance B () = MkB -- Defined at T4175.hs:13:15 type instance A (B a) b = () -- Defined at T4175.hs:10:15 +data instance B () = MkB -- Defined at T4175.hs:13:15 class C a where type family D a b :: * -- Defined at T4175.hs:16:5 @@ -18,38 +18,38 @@ type family E a :: * -- Defined at T4175.hs:24:1 data () = () -- Defined in ‘GHC.Tuple’ instance C () -- Defined at T4175.hs:21:10 -instance Monoid () -- Defined in ‘GHC.Base’ -instance Bounded () -- Defined in ‘GHC.Enum’ -instance Enum () -- Defined in ‘GHC.Enum’ -instance Read () -- Defined in ‘GHC.Read’ instance Eq () -- Defined in ‘GHC.Classes’ +instance Monoid () -- Defined in ‘GHC.Base’ instance Ord () -- Defined in ‘GHC.Classes’ instance Show () -- Defined in ‘GHC.Show’ +instance Read () -- Defined in ‘GHC.Read’ +instance Enum () -- Defined in ‘GHC.Enum’ +instance Bounded () -- Defined in ‘GHC.Enum’ type instance D () a = Bool -- Defined at T4175.hs:22:10 data instance B () = MkB -- Defined at T4175.hs:13:15 data Maybe a = Nothing | Just a -- Defined in ‘GHC.Base’ -instance Traversable Maybe -- Defined in ‘Data.Traversable’ -instance Monoid a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ -instance Foldable Maybe -- Defined in ‘Data.Foldable’ -instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ instance Applicative Maybe -- Defined in ‘GHC.Base’ +instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’ instance Functor Maybe -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ -instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’ +instance Monoid a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ +instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ +instance Foldable Maybe -- Defined in ‘Data.Foldable’ +instance Traversable Maybe -- Defined in ‘Data.Traversable’ type instance A (Maybe a) a = a -- Defined at T4175.hs:9:15 data Int = I# Int# -- Defined in ‘GHC.Types’ instance C Int -- Defined at T4175.hs:18:10 -instance Integral Int -- Defined in ‘GHC.Real’ -instance Num Int -- Defined in ‘GHC.Num’ -instance Real Int -- Defined in ‘GHC.Real’ -instance Bounded Int -- Defined in ‘GHC.Enum’ -instance Enum Int -- Defined in ‘GHC.Enum’ -instance Read Int -- Defined in ‘GHC.Read’ instance Eq Int -- Defined in ‘GHC.Classes’ instance Ord Int -- Defined in ‘GHC.Classes’ instance Show Int -- Defined in ‘GHC.Show’ +instance Read Int -- Defined in ‘GHC.Read’ +instance Enum Int -- Defined in ‘GHC.Enum’ +instance Num Int -- Defined in ‘GHC.Num’ +instance Real Int -- Defined in ‘GHC.Real’ +instance Bounded Int -- Defined in ‘GHC.Enum’ +instance Integral Int -- Defined in ‘GHC.Real’ type instance D Int b = String -- Defined at T4175.hs:19:10 type instance A Int Int = () -- Defined at T4175.hs:8:15 class Z a -- Defined at T4175.hs:28:1 diff --git a/testsuite/tests/ghci/scripts/T6018ghcifail.stderr b/testsuite/tests/ghci/scripts/T6018ghcifail.stderr index 9184aff580..c5037a1f58 100644 --- a/testsuite/tests/ghci/scripts/T6018ghcifail.stderr +++ b/testsuite/tests/ghci/scripts/T6018ghcifail.stderr @@ -49,7 +49,7 @@ <interactive>:60:15: error: Type family equation violates injectivity annotation. - Kind variable ‘k2’ cannot be inferred from the right-hand side. + Kind variable ‘k1’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: PolyKindVars '[] = '[] -- Defined at <interactive>:60:15 @@ -59,7 +59,7 @@ Kind variable ‘k’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (b :: k) (a :: k). + forall k (a :: k) (b :: k). Fc a b = Int -- Defined at <interactive>:64:15 <interactive>:68:15: error: @@ -68,7 +68,7 @@ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (b :: k) (a :: k). + forall k (a :: k) (b :: k). Gc a b = Int -- Defined at <interactive>:68:15 <interactive>:81:15: error: diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout index b577bdf403..c13a3f3ba0 100644 --- a/testsuite/tests/ghci/scripts/T7627.stdout +++ b/testsuite/tests/ghci/scripts/T7627.stdout @@ -1,30 +1,30 @@ data () = () -- Defined in ‘GHC.Tuple’ +instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ -instance Bounded () -- Defined in ‘GHC.Enum’ +instance Ord () -- Defined in ‘GHC.Classes’ +instance Show () -- Defined in ‘GHC.Show’ instance Read () -- Defined in ‘GHC.Read’ instance Enum () -- Defined in ‘GHC.Enum’ -instance Show () -- Defined in ‘GHC.Show’ -instance Eq () -- Defined in ‘GHC.Classes’ -instance Ord () -- Defined in ‘GHC.Classes’ +instance Bounded () -- Defined in ‘GHC.Enum’ data (##) = (##) -- Defined in ‘GHC.Prim’ () :: () (##) :: (# #) ( ) :: () (# #) :: (# #) data (,) a b = (,) a b -- Defined in ‘GHC.Tuple’ -instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ -instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ +instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ +instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ +instance Functor ((,) a) -- Defined in ‘GHC.Base’ +instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ instance (Monoid a, Monoid b) => Monoid (a, b) -- Defined in ‘GHC.Base’ -instance (Bounded a, Bounded b) => Bounded (a, b) - -- Defined in ‘GHC.Enum’ -instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’ -instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ -instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ -instance Functor ((,) a) -- Defined in ‘GHC.Base’ -instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ +instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ +instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ +instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ +instance (Bounded a, Bounded b) => Bounded (a, b) + -- Defined in ‘GHC.Enum’ data (#,#) (a :: TYPE k0) (b :: TYPE k1) = (#,#) a b -- Defined in ‘GHC.Prim’ (,) :: a -> b -> (a, b) diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout index 0b41ebb2c6..2b2c8b73ad 100644 --- a/testsuite/tests/ghci/scripts/T7939.stdout +++ b/testsuite/tests/ghci/scripts/T7939.stdout @@ -16,12 +16,12 @@ H :: Bool -> Bool type family J (a :: [k]) :: Bool where [k] J k '[] = 'False - [k, (t :: [k]), (h :: k)] J k (h : t) = 'True + [k, (h :: k), (t :: [k])] J k (h : t) = 'True -- Defined at T7939.hs:17:1 J :: [k] -> Bool type family K (a1 :: [a]) :: Maybe a where [a] K a '[] = 'Nothing - [a, (t :: [a]), (h :: a)] K a (h : t) = 'Just h + [a, (h :: a), (t :: [a])] K a (h : t) = 'Just h -- Defined at T7939.hs:21:1 K :: [a] -> Maybe a diff --git a/testsuite/tests/ghci/scripts/T8469.stdout b/testsuite/tests/ghci/scripts/T8469.stdout index 0bbaaedfbe..ec14842359 100644 --- a/testsuite/tests/ghci/scripts/T8469.stdout +++ b/testsuite/tests/ghci/scripts/T8469.stdout @@ -1,10 +1,10 @@ data Int = GHC.Types.I# GHC.Prim.Int# -- Defined in ‘GHC.Types’ -instance Bounded Int -- Defined in ‘GHC.Enum’ +instance Eq Int -- Defined in ‘GHC.Classes’ +instance Ord Int -- Defined in ‘GHC.Classes’ +instance Show Int -- Defined in ‘GHC.Show’ instance Read Int -- Defined in ‘GHC.Read’ instance Enum Int -- Defined in ‘GHC.Enum’ -instance Integral Int -- Defined in ‘GHC.Real’ instance Num Int -- Defined in ‘GHC.Num’ instance Real Int -- Defined in ‘GHC.Real’ -instance Show Int -- Defined in ‘GHC.Show’ -instance Eq Int -- Defined in ‘GHC.Classes’ -instance Ord Int -- Defined in ‘GHC.Classes’ +instance Bounded Int -- Defined in ‘GHC.Enum’ +instance Integral Int -- Defined in ‘GHC.Real’ diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout index 2aea35f3de..3995bc0b20 100644 --- a/testsuite/tests/ghci/scripts/T8535.stdout +++ b/testsuite/tests/ghci/scripts/T8535.stdout @@ -1,6 +1,6 @@ data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` -instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ instance Monad ((->) r) -- Defined in ‘GHC.Base’ +instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/T9881.stdout b/testsuite/tests/ghci/scripts/T9881.stdout index a73f0e8fb8..18fa4d521f 100644 --- a/testsuite/tests/ghci/scripts/T9881.stdout +++ b/testsuite/tests/ghci/scripts/T9881.stdout @@ -3,15 +3,15 @@ data Data.ByteString.Lazy.ByteString | Data.ByteString.Lazy.Internal.Chunk {-# UNPACK #-}Data.ByteString.ByteString Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ +instance Eq Data.ByteString.Lazy.ByteString + -- Defined in ‘Data.ByteString.Lazy.Internal’ instance Monoid Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ -instance Read Data.ByteString.Lazy.ByteString +instance Ord Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ instance Show Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ -instance Eq Data.ByteString.Lazy.ByteString - -- Defined in ‘Data.ByteString.Lazy.Internal’ -instance Ord Data.ByteString.Lazy.ByteString +instance Read Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ data Data.ByteString.ByteString @@ -20,13 +20,13 @@ data Data.ByteString.ByteString {-# UNPACK #-}Int {-# UNPACK #-}Int -- Defined in ‘Data.ByteString.Internal’ +instance Eq Data.ByteString.ByteString + -- Defined in ‘Data.ByteString.Internal’ instance Monoid Data.ByteString.ByteString -- Defined in ‘Data.ByteString.Internal’ -instance Read Data.ByteString.ByteString +instance Ord Data.ByteString.ByteString -- Defined in ‘Data.ByteString.Internal’ instance Show Data.ByteString.ByteString -- Defined in ‘Data.ByteString.Internal’ -instance Eq Data.ByteString.ByteString - -- Defined in ‘Data.ByteString.Internal’ -instance Ord Data.ByteString.ByteString +instance Read Data.ByteString.ByteString -- Defined in ‘Data.ByteString.Internal’ diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout index 0bffb9720c..372930d66d 100644 --- a/testsuite/tests/ghci/scripts/ghci011.stdout +++ b/testsuite/tests/ghci/scripts/ghci011.stdout @@ -1,33 +1,33 @@ data [] a = [] | a : [a] -- Defined in ‘GHC.Types’ -instance Monoid [a] -- Defined in ‘GHC.Base’ -instance Foldable [] -- Defined in ‘Data.Foldable’ -instance Traversable [] -- Defined in ‘Data.Traversable’ -instance Read a => Read [a] -- Defined in ‘GHC.Read’ -instance Show a => Show [a] -- Defined in ‘GHC.Show’ instance Applicative [] -- Defined in ‘GHC.Base’ +instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Functor [] -- Defined in ‘GHC.Base’ instance Monad [] -- Defined in ‘GHC.Base’ -instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ +instance Monoid [a] -- Defined in ‘GHC.Base’ instance Ord a => Ord [a] -- Defined in ‘GHC.Classes’ +instance Show a => Show [a] -- Defined in ‘GHC.Show’ +instance Read a => Read [a] -- Defined in ‘GHC.Read’ +instance Foldable [] -- Defined in ‘Data.Foldable’ +instance Traversable [] -- Defined in ‘Data.Traversable’ data () = () -- Defined in ‘GHC.Tuple’ +instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ -instance Read () -- Defined in ‘GHC.Read’ -instance Bounded () -- Defined in ‘GHC.Enum’ -instance Enum () -- Defined in ‘GHC.Enum’ instance Ord () -- Defined in ‘GHC.Classes’ instance Show () -- Defined in ‘GHC.Show’ -instance Eq () -- Defined in ‘GHC.Classes’ +instance Read () -- Defined in ‘GHC.Read’ +instance Enum () -- Defined in ‘GHC.Enum’ +instance Bounded () -- Defined in ‘GHC.Enum’ data (,) a b = (,) a b -- Defined in ‘GHC.Tuple’ -instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ -instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ +instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ +instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ +instance Functor ((,) a) -- Defined in ‘GHC.Base’ +instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ instance (Monoid a, Monoid b) => Monoid (a, b) -- Defined in ‘GHC.Base’ -instance (Bounded a, Bounded b) => Bounded (a, b) - -- Defined in ‘GHC.Enum’ -instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance (Ord a, Ord b) => Ord (a, b) -- Defined in ‘GHC.Classes’ -instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’ -instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ -instance Functor ((,) a) -- Defined in ‘GHC.Base’ -instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ +instance (Read a, Read b) => Read (a, b) -- Defined in ‘GHC.Read’ +instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ +instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ +instance (Bounded a, Bounded b) => Bounded (a, b) + -- Defined in ‘GHC.Enum’ diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout index 2aea35f3de..3995bc0b20 100644 --- a/testsuite/tests/ghci/scripts/ghci020.stdout +++ b/testsuite/tests/ghci/scripts/ghci020.stdout @@ -1,6 +1,6 @@ data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` -instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ instance Monad ((->) r) -- Defined in ‘GHC.Base’ +instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/should_run/T10145.stdout b/testsuite/tests/ghci/should_run/T10145.stdout index 2aea35f3de..3995bc0b20 100644 --- a/testsuite/tests/ghci/should_run/T10145.stdout +++ b/testsuite/tests/ghci/should_run/T10145.stdout @@ -1,6 +1,6 @@ data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` -instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ instance Applicative ((->) a) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ instance Monad ((->) r) -- Defined in ‘GHC.Base’ +instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/should_run/T12549.stdout b/testsuite/tests/ghci/should_run/T12549.stdout index fd0a45c46b..bd446f741a 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 (b :: k1) (a :: k1 -> k2 -> *) (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/T3017.stderr b/testsuite/tests/indexed-types/should_compile/T3017.stderr index 5e35716896..17d307d762 100644 --- a/testsuite/tests/indexed-types/should_compile/T3017.stderr +++ b/testsuite/tests/indexed-types/should_compile/T3017.stderr @@ -4,7 +4,7 @@ TYPE SIGNATURES emptyL :: forall a. ListColl a insert :: forall c. Coll c => Elem c -> c -> c test2 :: - forall a b c. (Elem c ~ (a, b), Num b, Num a, Coll c) => c -> c + forall c a b. (Elem c ~ (a, b), Num b, Num a, Coll c) => c -> c TYPE CONSTRUCTORS class Coll c where type family Elem c :: * open diff --git a/testsuite/tests/indexed-types/should_fail/T1897b.stderr b/testsuite/tests/indexed-types/should_fail/T1897b.stderr index b83c7ffe78..d3c8b06451 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 a (t :: * -> *). + isValid :: forall (t :: * -> *) a. (Bug a, Foldable t) => t (Depend a) -> Bool diff --git a/testsuite/tests/indexed-types/should_fail/T8518.stderr b/testsuite/tests/indexed-types/should_fail/T8518.stderr index a152f55f25..037bb76bbe 100644 --- a/testsuite/tests/indexed-types/should_fail/T8518.stderr +++ b/testsuite/tests/indexed-types/should_fail/T8518.stderr @@ -18,9 +18,9 @@ T8518.hs:14:18: error: callCont :: c -> Z c -> B c -> Maybe (F c) (bound at T8518.hs:14:1) T8518.hs:16:9: error: - • Couldn't match type ‘F t’ with ‘Z t -> B t -> F t’ - Expected type: t1 -> t -> F t - Actual type: t1 -> t -> Z t -> B t -> F t + • Couldn't match type ‘F t1’ with ‘Z t1 -> B t1 -> F t1’ + Expected type: t -> t1 -> F t1 + Actual type: t -> t1 -> Z t1 -> B t1 -> F t1 • In an equation for ‘callCont’: callCont c z b = rpt (4 :: Int) c z b @@ -28,4 +28,4 @@ T8518.hs:16:9: error: rpt 0 c' z' b' = fromJust (fst <$> (continue c' z' b')) rpt i c' z' b' = let ... in rpt (i - 1) c'' • Relevant bindings include - rpt :: t1 -> t -> F t (bound at T8518.hs:16:9) + rpt :: t -> t1 -> F t1 (bound at T8518.hs:16:9) diff --git a/testsuite/tests/indexed-types/should_fail/T9662.stderr b/testsuite/tests/indexed-types/should_fail/T9662.stderr index 54b05665a3..3cdc60a18c 100644 --- a/testsuite/tests/indexed-types/should_fail/T9662.stderr +++ b/testsuite/tests/indexed-types/should_fail/T9662.stderr @@ -1,7 +1,7 @@ T9662.hs:47:8: error: - • Couldn't match type ‘k’ with ‘Int’ - ‘k’ is a rigid type variable bound by + • Couldn't match type ‘m’ with ‘Int’ + ‘m’ is a rigid type variable bound by the type signature for: test :: forall sh k m n. Shape (((sh :. k) :. m) :. n) -> Shape (((sh :. m) :. n) :. k) diff --git a/testsuite/tests/module/mod72.stderr b/testsuite/tests/module/mod72.stderr index f546dc8139..69246edb76 100644 --- a/testsuite/tests/module/mod72.stderr +++ b/testsuite/tests/module/mod72.stderr @@ -1,2 +1,2 @@ -mod72.hs:3:7: error: Variable not in scope: g :: t1 -> t +mod72.hs:3:7: error: Variable not in scope: g :: t -> t1 diff --git a/testsuite/tests/parser/should_fail/readFail003.stderr b/testsuite/tests/parser/should_fail/readFail003.stderr index 2dca583aba..933f16179a 100644 --- a/testsuite/tests/parser/should_fail/readFail003.stderr +++ b/testsuite/tests/parser/should_fail/readFail003.stderr @@ -1,7 +1,7 @@ readFail003.hs:4:27: error: • Occurs check: cannot construct the infinite type: - a2 ~ (a2, [a1], [a]) + a ~ (a, [a1], [a2]) • In the expression: a In a pattern binding: ~(a, b, c) @@ -11,6 +11,6 @@ readFail003.hs:4:27: error: where nullity = null • Relevant bindings include - a :: a2 (bound at readFail003.hs:4:3) + a :: a (bound at readFail003.hs:4:3) b :: [a1] (bound at readFail003.hs:4:5) - c :: [a] (bound at readFail003.hs:4:7) + c :: [a2] (bound at readFail003.hs:4:7) diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr index d643f5f575..ba586bd7ca 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr @@ -1,28 +1,28 @@ TYPE SIGNATURES !! :: forall a. [a] -> Int -> a - $ :: forall b a. (a -> b) -> a -> b - $! :: forall b a. (a -> b) -> a -> b + $ :: 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 a c b. (b -> c) -> (a -> b) -> a -> c + . :: 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 b (m :: * -> *) a. Monad m => (a -> m b) -> m a -> 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 b a (m :: * -> *). Monad m => m a -> m b -> m b + >> :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b >>= :: - forall b a (m :: * -> *). Monad m => m a -> (a -> m b) -> m b + forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ^ :: forall b a. (Num a, Integral b) => a -> b -> a - ^^ :: forall b a. (Integral b, Fractional a) => a -> b -> a + ^^ :: forall a b. (Integral b, Fractional a) => a -> b -> a abs :: forall a. Num a => a -> a acos :: forall a. Floating a => a -> a acosh :: forall a. Floating a => a -> a @@ -39,22 +39,22 @@ TYPE SIGNATURES 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 b a. (Integral b, RealFrac a) => a -> b + ceiling :: forall a b. (Integral b, RealFrac a) => a -> b compare :: forall a. Ord a => a -> a -> Ordering concat :: forall (t :: * -> *) a. P.Foldable t => t [a] -> [a] concatMap :: - forall (t :: * -> *) b a. P.Foldable t => (a -> [b]) -> t a -> [b] - const :: forall b a. a -> b -> a + 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 b a c. ((a, b) -> c) -> a -> b -> c + 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 b c a. (a -> c) -> (b -> c) -> Either a b -> c + either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c elem :: forall (t :: * -> *) a. (Eq a, P.Foldable t) => a -> t a -> Bool encodeFloat :: forall a. RealFloat a => Integer -> Int -> a @@ -66,32 +66,32 @@ TYPE SIGNATURES even :: forall a. Integral a => a -> Bool exp :: forall a. Floating a => a -> a exponent :: forall a. RealFloat a => a -> Int - fail :: forall a (m :: * -> *). Monad m => String -> m a + fail :: forall (m :: * -> *) a. Monad m => String -> m a filter :: forall a. (a -> Bool) -> [a] -> [a] - flip :: forall c b a. (a -> b -> c) -> b -> a -> c + 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 b a. (Integral b, RealFrac a) => a -> b + floor :: forall a b. (Integral b, RealFrac a) => a -> b fmap :: - forall (f :: * -> *) b a. Functor f => (a -> b) -> f a -> f b + forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b foldl :: - forall (t :: * -> *) a b. + 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 foldr :: - forall (t :: * -> *) b a. + 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 b a. (Num b, Integral a) => a -> b + fromIntegral :: forall a b. (Num b, Integral a) => a -> b fromRational :: forall a. Fractional a => Rational -> a - fst :: forall b a. (a, b) -> a + fst :: forall a b. (a, b) -> a gcd :: forall a. Integral a => a -> a -> a getChar :: IO Char getContents :: IO String @@ -109,26 +109,26 @@ TYPE SIGNATURES iterate :: forall a. (a -> a) -> a -> [a] last :: forall a. [a] -> a lcm :: forall a. Integral a => a -> a -> a - length :: forall a (t :: * -> *). P.Foldable t => t a -> Int + 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 b a. Eq a => a -> [(a, b)] -> Maybe b - map :: forall b a. (a -> b) -> [a] -> [b] + lookup :: forall a b. Eq a => a -> [(a, b)] -> Maybe b + map :: forall a b. (a -> b) -> [a] -> [b] mapM :: - forall (t :: * -> *) b (m :: * -> *) a. + forall (t :: * -> *) (m :: * -> *) a b. (Monad m, P.Traversable t) => (a -> m b) -> t a -> m (t b) mapM_ :: - forall (t :: * -> *) b (m :: * -> *) a. + forall (t :: * -> *) (m :: * -> *) a b. (Monad m, P.Foldable t) => (a -> m b) -> t a -> m () max :: forall a. Ord a => a -> a -> a maxBound :: forall w. Bounded w => w maximum :: forall (t :: * -> *) a. (Ord a, P.Foldable t) => t a -> a - maybe :: forall a b. b -> (a -> b) -> Maybe a -> b + maybe :: forall b a. b -> (a -> b) -> Maybe a -> b min :: forall a. Ord a => a -> a -> a minBound :: forall w. Bounded w => w minimum :: @@ -138,7 +138,7 @@ TYPE SIGNATURES not :: Bool -> Bool notElem :: forall (t :: * -> *) a. (Eq a, P.Foldable t) => a -> t a -> Bool - null :: forall a (t :: * -> *). P.Foldable t => 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 @@ -148,7 +148,7 @@ TYPE SIGNATURES product :: forall (t :: * -> *) a. (Num a, P.Foldable t) => t a -> a properFraction :: - forall b a. (Integral b, RealFrac a) => a -> (b, a) + forall a b. (Integral b, RealFrac a) => a -> (b, a) putChar :: Char -> IO () putStr :: String -> IO () putStrLn :: String -> IO () @@ -162,26 +162,26 @@ TYPE SIGNATURES 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 b a. (Fractional b, Real a) => a -> b + realToFrac :: forall a b. (Fractional b, Real a) => 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 b a. (Integral b, RealFrac a) => a -> b + round :: forall a b. (Integral b, RealFrac a) => a -> b scaleFloat :: forall a. RealFloat a => Int -> a -> a - scanl :: forall a b. (b -> a -> b) -> b -> [a] -> [b] + scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b] scanl1 :: forall a. (a -> a -> a) -> [a] -> [a] - scanr :: forall b a. (a -> b -> b) -> b -> [a] -> [b] + scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b] scanr1 :: forall a. (a -> a -> a) -> [a] -> [a] - seq :: forall b a. a -> b -> b + seq :: forall a b. a -> b -> b sequence :: - forall a (m :: * -> *) (t :: * -> *). + forall (t :: * -> *) (m :: * -> *) a. (Monad m, P.Traversable t) => t (m a) -> m (t a) sequence_ :: - forall a (t :: * -> *) (m :: * -> *). + forall (t :: * -> *) (m :: * -> *) a. (Monad m, P.Foldable t) => t (m a) -> m () show :: forall a. Show a => a -> String @@ -210,22 +210,22 @@ TYPE SIGNATURES toEnum :: forall a. Enum a => Int -> a toInteger :: forall a. Integral a => a -> Integer toRational :: forall a. Real a => a -> Rational - truncate :: forall b a. (Integral b, RealFrac a) => a -> b - uncurry :: forall c b a. (a -> b -> c) -> (a, b) -> c + truncate :: forall a b. (Integral b, RealFrac a) => a -> b + uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c undefined :: forall w. w unlines :: [String] -> String until :: forall a. (a -> Bool) -> (a -> a) -> a -> a unwords :: [String] -> String - unzip :: forall b a. [(a, b)] -> ([a], [b]) - unzip3 :: forall c b a. [(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 b a. [a] -> [b] -> [(a, b)] - zip3 :: forall c b a. [a] -> [b] -> [c] -> [(a, b, c)] - zipWith :: forall c b a. (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 d c b a. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] + forall a b c d. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] || :: Bool -> Bool -> Bool TYPE CONSTRUCTORS COERCION AXIOMS diff --git a/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr b/testsuite/tests/partial-sigs/should_compile/Meltdown.stderr index 037cb20386..3d7146a8c6 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 param2 param1. + forall param1 param2. NukeMonad param1 param2 () -> NukeMonad param1 param2 () TYPE CONSTRUCTORS type role NukeMonad phantom phantom phantom diff --git a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr index d2442eb7ca..53b6021309 100644 --- a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr +++ b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - foo :: forall b a. (a, b) -> (a, b) + foo :: forall a b. (a, b) -> (a, b) TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] diff --git a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr index b682e1d7a1..dd6454b9b0 100644 --- a/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SkipMany.stderr @@ -2,7 +2,7 @@ TYPE SIGNATURES SkipMany.GenParser :: forall tok st a. tok -> st -> a -> GenParser tok st a skipMany :: - forall a st tok. 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/T10438.stderr b/testsuite/tests/partial-sigs/should_compile/T10438.stderr index c5238bb474..5acc3fa15b 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10438.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10438.stderr @@ -22,5 +22,5 @@ T10438.hs:7:22: warning: [-Wpartial-type-signatures (in -Wdefault)] • Relevant bindings include r :: p2 (bound at T10438.hs:6:11) g :: p2 -> p2 (bound at T10438.hs:6:9) - f :: p1 (bound at T10438.hs:5:5) - foo :: p1 -> p -> p (bound at T10438.hs:5:1) + f :: p (bound at T10438.hs:5:5) + foo :: p -> p1 -> p1 (bound at T10438.hs:5:1) diff --git a/testsuite/tests/partial-sigs/should_compile/T11192.stderr b/testsuite/tests/partial-sigs/should_compile/T11192.stderr index 8e47c4bb70..0f2d2e09b6 100644 --- a/testsuite/tests/partial-sigs/should_compile/T11192.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T11192.stderr @@ -18,11 +18,11 @@ T11192.hs:7:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Relevant bindings include fails :: a (bound at T11192.hs:6:1) T11192.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] - • Found type wildcard ‘_’ standing for ‘p1 -> p -> p’ - Where: ‘p1’ is a rigid type variable bound by - the inferred type of go :: p1 -> p -> p at T11192.hs:14:8-17 - ‘p’ is a rigid type variable bound by - the inferred type of go :: p1 -> p -> p at T11192.hs:14:8-17 + • Found type wildcard ‘_’ standing for ‘p -> p1 -> p1’ + Where: ‘p’ is a rigid type variable bound by + the inferred type of go :: p -> p1 -> p1 at T11192.hs:14:8-17 + ‘p1’ is a rigid type variable bound by + the inferred type of go :: p -> p1 -> p1 at T11192.hs:14:8-17 • In the type signature: go :: _ In the expression: let diff --git a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr index 945f24245b..880c72d6f1 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 w1 w2 w3. (w3 -> w2 -> w1) -> (w3, w2) -> w1 + unc :: forall w1 w2 w3. (w1 -> w2 -> w3) -> (w1, w2) -> w3 TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] diff --git a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr index b0a3a97024..1a2a7b3977 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 w b a. (a -> b -> w) -> (a, b) -> w + unc :: forall a b w. (a -> b -> w) -> (a, b) -> w TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] diff --git a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr index fedbaa96ad..352890a9fc 100644 --- a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - bar :: forall w t. t -> (t -> w) -> w + bar :: forall t w. t -> (t -> w) -> w foo :: forall a. (Show a, Enum a) => a -> String TYPE CONSTRUCTORS COERCION AXIOMS diff --git a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr index 43ba8ccce7..c1a7d84896 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: w0 from the context: (Eq a, w) bound by the inferred type for ‘foo’: - (Eq a, w) => a -> a + forall a (w :: Constraint). (Eq a, w) => 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 (w :: Constraint) a. (Eq a, w) => a -> a + foo :: forall a (w :: Constraint). (Eq a, w) => a -> a diff --git a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr index 0f21053621..7d7320f0fb 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 w0) from the context: (Show a, Eq w, Eq a) bound by the inferred type for ‘foo’: - (Show a, Eq w, Eq a) => a -> a -> String + forall a w. (Show a, Eq w, Eq a) => a -> a -> String at NamedWildcardsNotInMonotype.hs:5:1-33 The type variable ‘w0’ 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 w a. (Show a, Eq w, Eq a) => a -> a -> String + foo :: forall a w. (Show a, Eq w, Eq a) => a -> a -> String diff --git a/testsuite/tests/partial-sigs/should_fail/T10045.stderr b/testsuite/tests/partial-sigs/should_fail/T10045.stderr index 16a5bf876f..a18ef48b83 100644 --- a/testsuite/tests/partial-sigs/should_fail/T10045.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T10045.stderr @@ -1,10 +1,10 @@ T10045.hs:6:18: error: - • Found type wildcard ‘_’ standing for ‘t2 -> Bool -> t1’ - Where: ‘t2’ is a rigid type variable bound by - the inferred type of copy :: t2 -> Bool -> t1 at T10045.hs:7:10-34 - ‘t1’ is a rigid type variable bound by - the inferred type of copy :: t2 -> Bool -> t1 at T10045.hs:7:10-34 + • Found type wildcard ‘_’ standing for ‘t1 -> Bool -> t2’ + Where: ‘t1’ is a rigid type variable bound by + the inferred type of copy :: t1 -> Bool -> t2 at T10045.hs:7:10-34 + ‘t2’ is a rigid type variable bound by + the inferred type of copy :: t1 -> Bool -> t2 at T10045.hs:7:10-34 To use the inferred type, enable PartialTypeSignatures • In the type signature: copy :: _ In the expression: diff --git a/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr b/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr index c90699048b..15282550b5 100644 --- a/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr +++ b/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr @@ -1,16 +1,16 @@ TidyClash.hs:8:19: error: - • Found type wildcard ‘_’ standing for ‘w1’ - Where: ‘w1’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_, w1 -> w) + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of bar :: w_ -> (w_, w -> w1) at TidyClash.hs:9:1-28 To use the inferred type, enable PartialTypeSignatures • In the type signature: bar :: w_ -> (w_, _ -> _) TidyClash.hs:8:24: error: - • Found type wildcard ‘_’ standing for ‘w’ - Where: ‘w’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_, w1 -> w) + • Found type wildcard ‘_’ standing for ‘w1’ + Where: ‘w1’ is a rigid type variable bound by + the inferred type of bar :: w_ -> (w_, w -> w1) at TidyClash.hs:9:1-28 To use the inferred type, enable PartialTypeSignatures • In the type signature: bar :: w_ -> (w_, _ -> _) diff --git a/testsuite/tests/partial-sigs/should_fail/TidyClash2.stderr b/testsuite/tests/partial-sigs/should_fail/TidyClash2.stderr index 3488ffc3e2..42a98ad8ef 100644 --- a/testsuite/tests/partial-sigs/should_fail/TidyClash2.stderr +++ b/testsuite/tests/partial-sigs/should_fail/TidyClash2.stderr @@ -1,42 +1,42 @@ TidyClash2.hs:13:20: error: - • Found type wildcard ‘_’ standing for ‘w1’ - Where: ‘w1’ is a rigid type variable bound by - the inferred type of barry :: w1 -> w -> t at TidyClash2.hs:14:1-40 + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of barry :: w -> w1 -> t at TidyClash2.hs:14:1-40 To use the inferred type, enable PartialTypeSignatures • In the type signature: barry :: forall t. _ -> _ -> t TidyClash2.hs:13:25: error: - • Found type wildcard ‘_’ standing for ‘w’ - Where: ‘w’ is a rigid type variable bound by - the inferred type of barry :: w1 -> w -> t at TidyClash2.hs:14:1-40 + • Found type wildcard ‘_’ standing for ‘w1’ + Where: ‘w1’ is a rigid type variable bound by + the inferred type of barry :: w -> w1 -> t at TidyClash2.hs:14:1-40 To use the inferred type, enable PartialTypeSignatures • In the type signature: barry :: forall t. _ -> _ -> t TidyClash2.hs:14:13: error: - • Found type wildcard ‘_’ standing for ‘w1’ - Where: ‘w1’ is a rigid type variable bound by - the inferred type of barry :: w1 -> w -> t at TidyClash2.hs:14:1-40 + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of barry :: w -> w1 -> t at TidyClash2.hs:14:1-40 To use the inferred type, enable PartialTypeSignatures • In a pattern type signature: _ In the pattern: x :: _ In an equation for ‘barry’: barry (x :: _) (y :: _) = undefined :: _ • Relevant bindings include - barry :: w1 -> w -> t (bound at TidyClash2.hs:14:1) + barry :: w -> w1 -> t (bound at TidyClash2.hs:14:1) TidyClash2.hs:14:22: error: - • Found type wildcard ‘_’ standing for ‘w’ - Where: ‘w’ is a rigid type variable bound by - the inferred type of barry :: w1 -> w -> t at TidyClash2.hs:14:1-40 + • Found type wildcard ‘_’ standing for ‘w1’ + Where: ‘w1’ is a rigid type variable bound by + the inferred type of barry :: w -> w1 -> t at TidyClash2.hs:14:1-40 To use the inferred type, enable PartialTypeSignatures • In a pattern type signature: _ In the pattern: y :: _ In an equation for ‘barry’: barry (x :: _) (y :: _) = undefined :: _ • Relevant bindings include - x :: w1 (bound at TidyClash2.hs:14:8) - barry :: w1 -> w -> t (bound at TidyClash2.hs:14:1) + x :: w (bound at TidyClash2.hs:14:8) + barry :: w -> w1 -> t (bound at TidyClash2.hs:14:1) TidyClash2.hs:14:40: error: • Found type wildcard ‘_’ standing for ‘w2’ @@ -48,6 +48,6 @@ TidyClash2.hs:14:40: error: In an equation for ‘barry’: barry (x :: _) (y :: _) = undefined :: _ • Relevant bindings include - y :: w (bound at TidyClash2.hs:14:17) - x :: w1 (bound at TidyClash2.hs:14:8) - barry :: w1 -> w -> t (bound at TidyClash2.hs:14:1) + y :: w1 (bound at TidyClash2.hs:14:17) + x :: w (bound at TidyClash2.hs:14:8) + barry :: w -> w1 -> t (bound at TidyClash2.hs:14:1) diff --git a/testsuite/tests/patsyn/should_compile/T11213.stderr b/testsuite/tests/patsyn/should_compile/T11213.stderr index 838d75c3c7..a3df05c7a2 100644 --- a/testsuite/tests/patsyn/should_compile/T11213.stderr +++ b/testsuite/tests/patsyn/should_compile/T11213.stderr @@ -21,8 +21,8 @@ T11213.hs:23:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] T11213.hs:24:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: pattern Purp :: forall a a1. - (Num a1, Eq a1) => - Show a => a1 -> a -> ([a1], UnivProv a) + (Num a, Eq a) => + Show a1 => a -> a1 -> ([a], UnivProv a1) T11213.hs:25:1: warning: [-Wmissing-pattern-synonym-signatures (in -Wall)] Pattern synonym with no type signature: diff --git a/testsuite/tests/polykinds/T13371.hs b/testsuite/tests/polykinds/T13371.hs new file mode 100644 index 0000000000..41754b4a07 --- /dev/null +++ b/testsuite/tests/polykinds/T13371.hs @@ -0,0 +1,42 @@ +{-# LANGUAGE + MonoLocalBinds, + PolyKinds, + + FunctionalDependencies, + FlexibleContexts #-} + +-- reduced version of +-- http://code.haskell.org/~aavogt/HList_dredge_ghc802/Data/HList/Dredge.hs +-- +-- F ~ EnsureLabel +-- g_f ~ dredge +-- g_f' ~ dredge' + +{- ghc-8.0.2 + +too_eager.hs:25:14: warning: [-Wdeferred-type-errors] + • No instance for (F t0 (Proxy b0)) arising from a use of ‘g_f’ + • In the first argument of ‘id’, namely ‘(g_f a)’ + In the expression: id (g_f a) + In an equation for ‘g_f'’: g_f' a = id (g_f a) + + +ghc-7.10.3 can wait to select the instance for F + +-} + +module T13371 where + +import Data.Proxy + +class F a b | a -> b where + f :: a -> b + +g :: Proxy b -> c +g _ = undefined + +-- a type signature (what ghc infers) makes it work +-- g_f :: F a (Proxy b) => a -> c +g_f a = g (f a) + +g_f' a = id (g_f a) diff --git a/testsuite/tests/polykinds/T13393.hs b/testsuite/tests/polykinds/T13393.hs new file mode 100644 index 0000000000..f1c4af3fa0 --- /dev/null +++ b/testsuite/tests/polykinds/T13393.hs @@ -0,0 +1,66 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +module T13393 ( ) where + +import Control.Monad.Trans.RWS.Strict (RWST) +import Data.Functor.Identity (Identity) +import Data.Kind (Type) +import Data.Word (Word16) + +data Rate +data Audio (sampleRate :: Rate) (channelLayout :: Type) (encoding :: Type) +data EncodeResult = MkEncodeResult + { encodeResultLeftOverInput :: !(Maybe [Word16]) + } +data EncodeFailure +data AacEncErrorCode +data Aac (aot :: AacCodec) +data AacCodec +newtype AacEncSt (rate :: Rate) channels (codec :: AacCodec) = MkAacEncSt + { _leftOvers :: Maybe [Word16] + } + +-- makeLenses ''AacEncSt + +type Iso s t a b = forall p f. (Functor f) => (a -> f b) -> s -> (f t) +instance (Monad m, Monoid w) => MonadState s (RWST r w s m) where + +iso :: (s -> a) -> (b -> t) -> Iso s t a b +iso sa bt x = fmap bt . x . sa +{-# INLINE iso #-} + +leftOvers :: + forall rate_a750 + channels_a753 + codec_a757 + rate_aaYK + channels_aaYL + codec_aaYM. + Iso (AacEncSt rate_a750 channels_a753 codec_a757) (AacEncSt rate_aaYK channels_aaYL codec_aaYM) (Maybe [Word16]) (Maybe [Word16]) +leftOvers = (iso (\ (MkAacEncSt x_aaYN) -> x_aaYN)) MkAacEncSt +{-# INLINE leftOvers #-} + +type ASetter s t a b = (a -> Identity b) -> s -> Identity t +class Monad m => MonadState s m | m -> s where + +(.=) :: MonadState s m => ASetter s s a b -> b -> m () +l .= b = undefined +{-# INLINE (.=) #-} + +type AacEncT rate channels codec m a = RWST Int () (AacEncSt rate channels codec) m a + +encodeLinearToAac + :: AacEncT rate channels codec IO (Either EncodeFailure (Maybe (Audio rate channels (Aac codec)))) +encodeLinearToAac = do + mapM putBackLeftOverInputAndReturnOutput undefined + undefined + where + putBackLeftOverInputAndReturnOutput (MkEncodeResult x) = do + leftOvers .= x + undefined diff --git a/testsuite/tests/polykinds/T13393.stderr b/testsuite/tests/polykinds/T13393.stderr new file mode 100644 index 0000000000..39ea640633 --- /dev/null +++ b/testsuite/tests/polykinds/T13393.stderr @@ -0,0 +1,25 @@ + +T13393.hs:61:3: error: + • Ambiguous type variable ‘t0’ arising from a use of ‘mapM’ + prevents the constraint ‘(Traversable t0)’ from being solved. + Probable fix: use a type annotation to specify what ‘t0’ should be. + These potential instances exist: + instance Traversable (Either a) -- Defined in ‘Data.Traversable’ + instance Traversable Identity -- Defined in ‘Data.Traversable’ + instance Traversable Maybe -- Defined in ‘Data.Traversable’ + ...plus two others + ...plus 24 instances involving out-of-scope types + (use -fprint-potential-instances to see them all) + • In a stmt of a 'do' block: + mapM putBackLeftOverInputAndReturnOutput undefined + In the expression: + do mapM putBackLeftOverInputAndReturnOutput undefined + undefined + In an equation for ‘encodeLinearToAac’: + encodeLinearToAac + = do mapM putBackLeftOverInputAndReturnOutput undefined + undefined + where + putBackLeftOverInputAndReturnOutput (MkEncodeResult x) + = do leftOvers .= x + .... diff --git a/testsuite/tests/polykinds/T7438.stderr b/testsuite/tests/polykinds/T7438.stderr index da55bb4d00..a198657754 100644 --- a/testsuite/tests/polykinds/T7438.stderr +++ b/testsuite/tests/polykinds/T7438.stderr @@ -1,19 +1,19 @@ T7438.hs:6:14: error: - • Couldn't match expected type ‘p’ with actual type ‘p1’ - ‘p’ is untouchable + • Couldn't match expected type ‘p1’ with actual type ‘p’ + ‘p1’ is untouchable inside the constraints: b ~ a bound by a pattern with constructor: 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 - the inferred type of go :: Thrist a b -> p1 -> p at T7438.hs:6:1-16 ‘p1’ is a rigid type variable bound by - the inferred type of go :: Thrist a b -> p1 -> p at T7438.hs:6:1-16 + the inferred type of go :: Thrist a b -> p -> p1 at T7438.hs:6:1-16 + ‘p’ is a rigid type variable bound by + the inferred type of go :: Thrist a b -> p -> p1 at T7438.hs:6:1-16 Possible fix: add a type signature for ‘go’ • In the expression: acc In an equation for ‘go’: go Nil acc = acc • Relevant bindings include - acc :: p1 (bound at T7438.hs:6:8) - go :: Thrist a b -> p1 -> p (bound at T7438.hs:6:1) + acc :: p (bound at T7438.hs:6:8) + go :: Thrist a b -> p -> p1 (bound at T7438.hs:6:1) diff --git a/testsuite/tests/polykinds/T7524.stderr b/testsuite/tests/polykinds/T7524.stderr index c096719735..2340ce1aa6 100644 --- a/testsuite/tests/polykinds/T7524.stderr +++ b/testsuite/tests/polykinds/T7524.stderr @@ -2,5 +2,5 @@ T7524.hs:5:15: error: Conflicting family instance declarations: forall k2 (a :: k2). F a a = Int -- Defined at T7524.hs:5:15 - forall k2 k1 (b :: k2) (a :: k1). + forall k2 k1 (a :: k1) (b :: k2). F a b = Bool -- Defined at T7524.hs:6:15 diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index e8a0facaea..eb5b09a897 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -157,3 +157,5 @@ test('T12885', normal, compile, ['']) test('T13267', normal, compile_fail, ['']) test('T13394a', normal, compile, ['']) test('T13394', normal, compile, ['']) +test('T13371', normal, compile, ['']) +test('T13393', normal, compile_fail, ['']) diff --git a/testsuite/tests/rename/should_fail/T2993.stderr b/testsuite/tests/rename/should_fail/T2993.stderr index 4baecc277b..4cae65ae88 100644 --- a/testsuite/tests/rename/should_fail/T2993.stderr +++ b/testsuite/tests/rename/should_fail/T2993.stderr @@ -1,4 +1,4 @@ T2993.hs:7:13: error: - • Variable not in scope: (<**>) :: t1 -> (b -> b) -> t + • Variable not in scope: (<**>) :: t -> (b -> b) -> t1 • Perhaps you meant ‘<*>’ (imported from Prelude) diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr index e79bfbbc92..1bb719d2db 100644 --- a/testsuite/tests/simplCore/should_compile/T3234.stderr +++ b/testsuite/tests/simplCore/should_compile/T3234.stderr @@ -54,8 +54,8 @@ Total ticks: 55 1 b 1 c 1 n - 1 a 1 b + 1 a 1 k 1 z 1 g diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index 7d0f0815dc..9c13f1791d 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -7,20 +7,20 @@ tc141.hs:11:12: error: In a pattern binding: (p :: a, q :: a) = x tc141.hs:11:31: error: - • Couldn't match expected type ‘a2’ with actual type ‘a1’ + • Couldn't match expected type ‘a2’ with actual type ‘a’ because type variable ‘a2’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - a2 + forall a2. a2 at tc141.hs:11:34 • In the expression: q :: a In the expression: (q :: a, p) In the expression: let (p :: a, q :: a) = x in (q :: a, p) • Relevant bindings include - p :: a1 (bound at tc141.hs:11:12) - q :: a1 (bound at tc141.hs:11:17) - x :: (a1, a1) (bound at tc141.hs:11:3) - f :: (a1, a1) -> (a, a1) (bound at tc141.hs:11:1) + p :: a (bound at tc141.hs:11:12) + q :: a (bound at tc141.hs:11:17) + x :: (a, a) (bound at tc141.hs:11:3) + f :: (a, a) -> (a1, a) (bound at tc141.hs:11:1) tc141.hs:13:13: error: • You cannot bind scoped type variable ‘a’ @@ -39,7 +39,7 @@ tc141.hs:15:18: error: because type variable ‘a2’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - v :: a2 + v :: forall a2. a2 at tc141.hs:14:14-19 • In the expression: b In an equation for ‘v’: v = b @@ -51,4 +51,4 @@ tc141.hs:15:18: error: • Relevant bindings include v :: a2 (bound at tc141.hs:15:14) b :: p (bound at tc141.hs:13:5) - g :: a1 -> p -> a (bound at tc141.hs:13:1) + g :: a -> p -> a1 (bound at tc141.hs:13:1) diff --git a/testsuite/tests/typecheck/should_compile/tc231.stderr b/testsuite/tests/typecheck/should_compile/tc231.stderr index e667f3523b..a73b7c3200 100644 --- a/testsuite/tests/typecheck/should_compile/tc231.stderr +++ b/testsuite/tests/typecheck/should_compile/tc231.stderr @@ -2,7 +2,7 @@ TYPE SIGNATURES Node :: forall s a chain. s -> a -> chain -> Q s a chain Z :: forall a. a -> Z a foo :: - forall chain s b. + forall s b chain. Zork s (Z [Char]) b => Q s (Z [Char]) chain -> ST s () huh :: diff --git a/testsuite/tests/typecheck/should_fail/T12177.stderr b/testsuite/tests/typecheck/should_fail/T12177.stderr index 03c885a577..ae57decfbc 100644 --- a/testsuite/tests/typecheck/should_fail/T12177.stderr +++ b/testsuite/tests/typecheck/should_fail/T12177.stderr @@ -2,24 +2,24 @@ T12177.hs:3:19: error: • Found hole: _ :: t Where: ‘t’ is a rigid type variable bound by - the inferred type of bar :: p1 -> p -> t at T12177.hs:3:1-19 + the inferred type of bar :: p -> p1 -> t at T12177.hs:3:1-19 • In the expression: _ In the expression: \ x -> _ In the expression: \ x -> \ x -> _ • Relevant bindings include - x :: p (bound at T12177.hs:3:14) - bar :: p1 -> p -> t (bound at T12177.hs:3:1) + x :: p1 (bound at T12177.hs:3:14) + bar :: p -> p1 -> t (bound at T12177.hs:3:1) T12177.hs:5:37: error: • Found hole: _ :: t Where: ‘t’ is a rigid type variable bound by - the inferred type of baz :: p4 -> p3 -> p2 -> p1 -> p -> t + the inferred type of baz :: p -> p1 -> p2 -> p3 -> p4 -> t at T12177.hs:5:1-37 • In the expression: _ In the expression: \ z -> _ In the expression: \ x -> \ z -> _ • Relevant bindings include - z :: p (bound at T12177.hs:5:32) - x :: p1 (bound at T12177.hs:5:26) - y :: p3 (bound at T12177.hs:5:14) - baz :: p4 -> p3 -> p2 -> p1 -> p -> t (bound at T12177.hs:5:1) + z :: p4 (bound at T12177.hs:5:32) + x :: p3 (bound at T12177.hs:5:26) + y :: p1 (bound at T12177.hs:5:14) + baz :: p -> p1 -> p2 -> p3 -> p4 -> t (bound at T12177.hs:5:1) diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.stderr b/testsuite/tests/typecheck/should_fail/T6018fail.stderr index 2525934a5d..e3fe13ada5 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018fail.stderr @@ -69,7 +69,7 @@ T6018fail.hs:59:10: error: T6018fail.hs:62:15: error: Type family equation violates injectivity annotation. - Kind variable ‘k2’ cannot be inferred from the right-hand side. + Kind variable ‘k1’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: PolyKindVars '[] = '[] -- Defined at T6018fail.hs:62:15 @@ -79,7 +79,7 @@ T6018fail.hs:66:15: error: Kind variable ‘k’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (b :: k) (a :: k). + forall k (a :: k) (b :: k). Fc a b = Int -- Defined at T6018fail.hs:66:15 T6018fail.hs:70:15: error: @@ -88,7 +88,7 @@ T6018fail.hs:70:15: error: cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (b :: k) (a :: k). + forall k (a :: k) (b :: k). Gc a b = Int -- Defined at T6018fail.hs:70:15 T6018fail.hs:74:15: error: @@ -145,7 +145,7 @@ T6018fail.hs:118:15: error: cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (c :: k) b a. + forall k a b (c :: k). G7 a b c = [G7a a b c] -- Defined at T6018fail.hs:118:15 T6018fail.hs:129:1: error: diff --git a/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr b/testsuite/tests/typecheck/should_fail/T6018failclosed.stderr index 3ceb044591..9914842013 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: cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k1 k2 (c :: k1) (b :: k2). + forall k1 k2 (b :: k2) (c :: k1). JClosed Int b c = Char -- Defined at T6018failclosed.hs:25:5 • In the equations for closed type family ‘JClosed’ In the type family declaration for ‘JClosed’ @@ -90,7 +90,7 @@ T6018failclosed.hs:66:5: error: Kind variable ‘k’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - forall k (b :: k) (a :: k). + forall k (a :: k) (b :: k). Gc 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/T7734.stderr b/testsuite/tests/typecheck/should_fail/T7734.stderr index a39b0488c3..05002109ab 100644 --- a/testsuite/tests/typecheck/should_fail/T7734.stderr +++ b/testsuite/tests/typecheck/should_fail/T7734.stderr @@ -1,18 +1,18 @@ T7734.hs:4:13: error: - • Occurs check: cannot construct the infinite type: t1 ~ t1 -> t + • Occurs check: cannot construct the infinite type: t ~ t -> t1 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘f’: x `f` y = x x • Relevant bindings include - x :: t1 -> t (bound at T7734.hs:4:1) - f :: (t1 -> t) -> p -> t (bound at T7734.hs:4:3) + x :: t -> t1 (bound at T7734.hs:4:1) + f :: (t -> t1) -> p -> t1 (bound at T7734.hs:4:3) T7734.hs:5:13: error: - • Occurs check: cannot construct the infinite type: t1 ~ t1 -> t + • Occurs check: cannot construct the infinite type: t ~ t -> t1 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘&’: (&) x y = x x • Relevant bindings include - x :: t1 -> t (bound at T7734.hs:5:5) - (&) :: (t1 -> t) -> p -> t (bound at T7734.hs:5:1) + x :: t -> t1 (bound at T7734.hs:5:5) + (&) :: (t -> t1) -> p -> t1 (bound at T7734.hs:5:1) diff --git a/testsuite/tests/typecheck/should_fail/T8142.stderr b/testsuite/tests/typecheck/should_fail/T8142.stderr index 6916435d0d..aec8b3b55c 100644 --- a/testsuite/tests/typecheck/should_fail/T8142.stderr +++ b/testsuite/tests/typecheck/should_fail/T8142.stderr @@ -8,7 +8,7 @@ T8142.hs:6:18: error: • In the ambiguity check for the inferred type for ‘h’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - h :: forall (g :: * -> *) a. Nu ((,) a) -> Nu g + h :: forall a (g :: * -> *). Nu ((,) a) -> Nu g In an equation for ‘tracer’: tracer = h diff --git a/testsuite/tests/typecheck/should_fail/T8883.stderr b/testsuite/tests/typecheck/should_fail/T8883.stderr index 25fd7c06a0..6f4946653b 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 b a. + fold :: forall a b. (Regular a, Functor (PF a)) => (PF a b -> b) -> a -> b diff --git a/testsuite/tests/typecheck/should_fail/mc25.stderr b/testsuite/tests/typecheck/should_fail/mc25.stderr index 88feec902f..5c29197f04 100644 --- a/testsuite/tests/typecheck/should_fail/mc25.stderr +++ b/testsuite/tests/typecheck/should_fail/mc25.stderr @@ -1,9 +1,9 @@ mc25.hs:9:46: error: - • Couldn't match type ‘a -> t’ with ‘Int’ - Expected type: (a -> t) -> [a] -> [t1 a] - Actual type: Int -> [t1 a] -> [t1 a] + • Couldn't match type ‘a -> t1’ with ‘Int’ + Expected type: (a -> t1) -> [a] -> [t a] + Actual type: Int -> [t a] -> [t a] • In the expression: take In a stmt of a monad comprehension: then group by x using take In the expression: [x | x <- [1 .. 10], then group by x using take] - • Relevant bindings include z :: [t1 t] (bound at mc25.hs:9:1) + • Relevant bindings include z :: [t t1] (bound at mc25.hs:9:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail049.stderr b/testsuite/tests/typecheck/should_fail/tcfail049.stderr index ec83902d6f..1b74ce0070 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail049.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail049.stderr @@ -1,2 +1,2 @@ -tcfail049.hs:3:7: error: Variable not in scope: g :: t1 -> t +tcfail049.hs:3:7: error: Variable not in scope: g :: t -> t1 diff --git a/testsuite/tests/typecheck/should_fail/tcfail050.stderr b/testsuite/tests/typecheck/should_fail/tcfail050.stderr index 9d6a0c06b2..2ca5065938 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail050.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail050.stderr @@ -1,3 +1,3 @@ tcfail050.hs:3:7: error: - Data constructor not in scope: B :: t1 -> t + Data constructor not in scope: B :: t -> t1 |