diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-10 11:46:50 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-10 16:05:21 +0000 |
commit | 48d1866e9051e52b80c9c88547bd66d66483f1d5 (patch) | |
tree | 72047939e1bad05062f7518db97b6c999d32c948 /testsuite/tests | |
parent | 7e96526ac2ef5987ecb03217d3d616b6281c1441 (diff) | |
download | haskell-48d1866e9051e52b80c9c88547bd66d66483f1d5.tar.gz |
Improve error messages for skolems
In error messages like this
• Couldn't match type ‘c’ with ‘f0 (a -> b)’
‘c’ is a rigid type variable bound by
the type signature for:
f :: ((a -> b) -> b) -> forall c. c -> a
we need to take case both to actually show that 'forall c',
and to make sure that its name lines with the 'c' in the
error message.
This has been shaky for some time, and this commit puts it on solid
ground. See TcRnTypes: Note [SigSkol SkolemInfo]
The main changes are
* SigSkol gets an extra field that records the way in which the
type signature was skolemised.
* The type in SigSkol is now the /un/-skolemised version
* pprSkolemInfo uses the info to make the tidy type line up
nicely
Lots of error message wibbles!
Diffstat (limited to 'testsuite/tests')
51 files changed, 118 insertions, 104 deletions
diff --git a/testsuite/tests/ado/ado005.stderr b/testsuite/tests/ado/ado005.stderr index 90d0b023bf..a7984b4757 100644 --- a/testsuite/tests/ado/ado005.stderr +++ b/testsuite/tests/ado/ado005.stderr @@ -1,21 +1,25 @@ ado005.hs:8:3: error: - Could not deduce (Monad f) arising from a do statement - from the context: Applicative f - bound by the type signature for: - test :: Applicative f => (Int -> f Int) -> f Int - at ado005.hs:6:1-48 - Possible fix: - add (Monad f) to the context of - the type signature for: - test :: Applicative f => (Int -> f Int) -> f Int - In a stmt of a 'do' block: x <- f 3 - In the expression: - do x <- f 3 - y <- f x - return (x + y) - In an equation for ‘test’: - test f - = do x <- f 3 - y <- f x - return (x + y) + • Could not deduce (Monad f) arising from a do statement + from the context: Applicative f + bound by the type signature for: + test :: forall (f :: * -> *). + Applicative f => + (Int -> f Int) -> f Int + at ado005.hs:6:1-48 + Possible fix: + add (Monad f) to the context of + the type signature for: + test :: forall (f :: * -> *). + Applicative f => + (Int -> f Int) -> f Int + • In a stmt of a 'do' block: x <- f 3 + In the expression: + do x <- f 3 + y <- f x + return (x + y) + In an equation for ‘test’: + test f + = do x <- f 3 + y <- f x + return (x + y) diff --git a/testsuite/tests/backpack/should_fail/bkpfail24.stderr b/testsuite/tests/backpack/should_fail/bkpfail24.stderr index 53312d23fe..ef6a7d6c01 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail24.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail24.stderr @@ -7,7 +7,7 @@ bkpfail24.bkp:14:15: error: • Could not deduce: a ~ b from the context: {H1.T} ~ {H2.T} bound by the type signature for: - f :: {H1.T} ~ {H2.T} => a -> b + f :: forall a b. {H1.T} ~ {H2.T} => a -> b at bkpfail24.bkp:13:9-34 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/backpack/should_fail/bkpfail44.stderr b/testsuite/tests/backpack/should_fail/bkpfail44.stderr index 127083f453..c16b2f2527 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail44.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail44.stderr @@ -6,7 +6,7 @@ bkpfail44.bkp:10:15: error: • Could not deduce: a ~ b from the context: Coercible (T a) (T b) bound by the type signature for: - f :: Coercible (T a) (T b) => a -> b + f :: forall a b. Coercible (T a) (T b) => a -> b at bkpfail44.bkp:9:9-44 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/deriving/should_fail/T5287.stderr b/testsuite/tests/deriving/should_fail/T5287.stderr index 6307c36f24..20ad31dec3 100644 --- a/testsuite/tests/deriving/should_fail/T5287.stderr +++ b/testsuite/tests/deriving/should_fail/T5287.stderr @@ -3,7 +3,7 @@ T5287.hs:6:10: error: • Could not deduce (A a oops0) from the context: A a oops bound by an instance declaration: - A a oops => Read (D a) + forall a oops. A a oops => Read (D a) at T5287.hs:6:10-31 The type variable ‘oops0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr index 596b6e2612..32e0138fe6 100644 --- a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr +++ b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr @@ -4,7 +4,7 @@ PushedInAsGivens.hs:10:31: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - foo :: F Int ~ [a1] => a1 -> Int + foo :: forall a1. F Int ~ [a1] => a1 -> Int at PushedInAsGivens.hs:9:13-44 • In the expression: y In the first argument of ‘length’, namely ‘[x, y]’ diff --git a/testsuite/tests/indexed-types/should_compile/T3208b.stderr b/testsuite/tests/indexed-types/should_compile/T3208b.stderr index c017701a27..063870465b 100644 --- a/testsuite/tests/indexed-types/should_compile/T3208b.stderr +++ b/testsuite/tests/indexed-types/should_compile/T3208b.stderr @@ -4,7 +4,9 @@ T3208b.hs:15:15: error: arising from a use of ‘apply’ from the context: (OTerm a ~ STerm a, OBJECT a, SUBST a) bound by the type signature for: - fce' :: (OTerm a ~ STerm a, OBJECT a, SUBST a) => a -> c + fce' :: forall a c. + (OTerm a ~ STerm a, OBJECT a, SUBST a) => + a -> c at T3208b.hs:14:1-56 The type variable ‘o0’ is ambiguous • In the first argument of ‘fce’, namely ‘(apply f)’ diff --git a/testsuite/tests/indexed-types/should_fail/T2664.stderr b/testsuite/tests/indexed-types/should_fail/T2664.stderr index 1217196f8a..21fbb64e3c 100644 --- a/testsuite/tests/indexed-types/should_fail/T2664.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2664.stderr @@ -3,7 +3,8 @@ T2664.hs:31:9: error: • Could not deduce: Dual a ~ Dual b from the context: ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) bound by the type signature for: - newPChan :: ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) => + newPChan :: forall c. + ((a :*: b) ~ Dual c, c ~ Dual (a :*: b)) => IO (PChan (a :*: b), PChan c) at T2664.hs:23:5-12 Expected type: IO (PChan (a :*: b), PChan c) diff --git a/testsuite/tests/indexed-types/should_fail/T4093a.stderr b/testsuite/tests/indexed-types/should_fail/T4093a.stderr index 64589234d6..7b2d92f8ed 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093a.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4093a.stderr @@ -3,7 +3,7 @@ T4093a.hs:8:8: error: • Could not deduce: e ~ () from the context: Foo e ~ Maybe e bound by the type signature for: - hang :: Foo e ~ Maybe e => Foo e + hang :: forall e. Foo e ~ Maybe e => Foo e at T4093a.hs:7:1-34 ‘e’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/indexed-types/should_fail/T4093b.stderr b/testsuite/tests/indexed-types/should_fail/T4093b.stderr index 1796ed1c52..195b113ede 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093b.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4093b.stderr @@ -4,7 +4,8 @@ T4093b.hs:31:13: error: from the context: (EitherCO e (A C O n) (A O O n) ~ A e O n, EitherCO x (A C C n) (A C O n) ~ A C x n) bound by the type signature for: - blockToNodeList :: (EitherCO e (A C O n) (A O O n) ~ A e O n, + blockToNodeList :: forall (n :: * -> * -> *) e x. + (EitherCO e (A C O n) (A O O n) ~ A e O n, EitherCO x (A C C n) (A C O n) ~ A C x n) => Block n e x -> A e x n at T4093b.hs:(19,1)-(22,26) diff --git a/testsuite/tests/indexed-types/should_fail/T7194.stderr b/testsuite/tests/indexed-types/should_fail/T7194.stderr index c48a3de15d..d509f9fac9 100644 --- a/testsuite/tests/indexed-types/should_fail/T7194.stderr +++ b/testsuite/tests/indexed-types/should_fail/T7194.stderr @@ -4,7 +4,7 @@ T7194.hs:18:35: error: because type variable ‘a’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - g :: C (F a) => a -> Int + g :: forall a. C (F a) => a -> Int at T7194.hs:17:18-41 • In the expression: foo y In the first argument of ‘length’, namely ‘[x, foo y]’ diff --git a/testsuite/tests/monadfail/MonadFailErrors.stderr b/testsuite/tests/monadfail/MonadFailErrors.stderr index 1507984d14..81ad56c910 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.stderr +++ b/testsuite/tests/monadfail/MonadFailErrors.stderr @@ -5,12 +5,12 @@ MonadFailErrors.hs:16:5: error: with the failable pattern ‘Just x’ from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailErrors.hs:14:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined diff --git a/testsuite/tests/monadfail/MonadFailWarnings.stderr b/testsuite/tests/monadfail/MonadFailWarnings.stderr index ac16d6cd9e..7471bd9373 100644 --- a/testsuite/tests/monadfail/MonadFailWarnings.stderr +++ b/testsuite/tests/monadfail/MonadFailWarnings.stderr @@ -5,12 +5,12 @@ MonadFailWarnings.hs:19:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) (this will become an error in a future GHC release) from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailWarnings.hs:17:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr index 4cd52315f0..44bc014f84 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr @@ -16,7 +16,7 @@ overloadedlabelsfail01.hs:14:5: error: arising from the overloaded label ‘#y’ from the context: IsLabel "x" t bound by the type signature for: - c :: IsLabel "x" t => t + c :: forall t. IsLabel "x" t => t at overloadedlabelsfail01.hs:13:1-23 • In the expression: #y In an equation for ‘c’: c = #y diff --git a/testsuite/tests/parser/should_fail/T7848.stderr b/testsuite/tests/parser/should_fail/T7848.stderr index fe949d944a..95ac7374ef 100644 --- a/testsuite/tests/parser/should_fail/T7848.stderr +++ b/testsuite/tests/parser/should_fail/T7848.stderr @@ -9,7 +9,7 @@ T7848.hs:10:9: error: because type variable ‘a’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - (&) :: a + (&) :: forall a. a at T7848.hs:10:9-35 • In the SPECIALISE pragma {-# SPECIALIZE (&) :: a #-} In an equation for ‘x’: diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index 3027d17d1b..d397e1f6ba 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -53,7 +53,7 @@ T10403.hs:28:8: warning: [-Wdeferred-type-errors (in -Wdefault)] because type variable ‘t’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - app2 :: H (B t) + app2 :: forall t. H (B t) at T10403.hs:27:1-15 Expected type: H (B t) Actual type: H f0 diff --git a/testsuite/tests/polykinds/T7230.stderr b/testsuite/tests/polykinds/T7230.stderr index 0ca0310a00..f0a29bb2d6 100644 --- a/testsuite/tests/polykinds/T7230.stderr +++ b/testsuite/tests/polykinds/T7230.stderr @@ -3,7 +3,9 @@ T7230.hs:48:32: error: • Could not deduce: (x :<<= x1) ~ 'True from the context: Increasing xs ~ 'True bound by the type signature for: - crash :: Increasing xs ~ 'True => SList xs -> SBool (Increasing xs) + crash :: forall (xs :: [Nat]). + Increasing xs ~ 'True => + SList xs -> SBool (Increasing xs) at T7230.hs:47:1-68 or from: xs ~ (x : xs1) bound by a pattern with constructor: diff --git a/testsuite/tests/polykinds/T7594.stderr b/testsuite/tests/polykinds/T7594.stderr index be52e41d31..3ea08a3fb8 100644 --- a/testsuite/tests/polykinds/T7594.stderr +++ b/testsuite/tests/polykinds/T7594.stderr @@ -4,7 +4,7 @@ T7594.hs:35:12: error: ‘b’ is untouchable inside the constraints: (:&:) c0 Real a bound by a type expected by the context: - (:&:) c0 Real a => a -> b + forall a. (:&:) c0 Real a => a -> b at T7594.hs:35:8-19 ‘b’ is a rigid type variable bound by the inferred type of bar2 :: b at T7594.hs:35:1-19 diff --git a/testsuite/tests/typecheck/should_compile/T7220a.stderr b/testsuite/tests/typecheck/should_compile/T7220a.stderr index 6e25e7a8f1..a1e865f131 100644 --- a/testsuite/tests/typecheck/should_compile/T7220a.stderr +++ b/testsuite/tests/typecheck/should_compile/T7220a.stderr @@ -3,13 +3,12 @@ T7220a.hs:17:6: error: • Could not deduce (C a b) from the context: (C a0 b, TF b ~ Y) bound by the type signature for: - f :: (C a0 b, TF b ~ Y) => b + f :: forall b. (C a0 b, TF b ~ Y) => b at T7220a.hs:17:6-44 Possible fix: add (C a b) to the context of the type signature for: - f :: (C a0 b, TF b ~ Y) => b + f :: forall b. (C a0 b, TF b ~ Y) => b • In the ambiguity check for ‘f’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - f :: (forall b. (C a b, TF b ~ Y) => b) -> X + In the type signature: f :: (forall b. (C a b, TF b ~ Y) => b) -> X diff --git a/testsuite/tests/typecheck/should_compile/T9834.stderr b/testsuite/tests/typecheck/should_compile/T9834.stderr index 8fb1db79a8..303b1defe6 100644 --- a/testsuite/tests/typecheck/should_compile/T9834.stderr +++ b/testsuite/tests/typecheck/should_compile/T9834.stderr @@ -30,9 +30,7 @@ T9834.hs:23:10: warning: [-Wdeferred-type-errors (in -Wdefault)] at T9834.hs:22:11-74 ‘a1’ is a rigid type variable bound by a type expected by the context: - forall (q :: * -> *) a1. - Applicative q => - Comp p q a1 -> Comp p q a1 + forall (q :: * -> *). Applicative q => Nat (Comp p q) (Comp p q) at T9834.hs:23:10-19 Expected type: Comp p q a1 -> Comp p q a1 Actual type: Comp p q a -> Comp p q a diff --git a/testsuite/tests/typecheck/should_compile/T9939.stderr b/testsuite/tests/typecheck/should_compile/T9939.stderr index c4866790c8..2ebc927006 100644 --- a/testsuite/tests/typecheck/should_compile/T9939.stderr +++ b/testsuite/tests/typecheck/should_compile/T9939.stderr @@ -2,19 +2,19 @@ T9939.hs:6:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f1 :: (Eq a, Ord a) => a -> a -> Bool + f1 :: forall a. (Eq a, Ord a) => a -> a -> Bool T9939.hs:10:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f2 :: (Eq a, Ord a) => a -> a -> Bool + f2 :: forall a. (Eq a, Ord a) => a -> a -> Bool T9939.hs:14:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq b • In the type signature for: - f3 :: (Eq a, a ~ b, Eq b) => a -> b -> Bool + f3 :: forall a b. (Eq a, a ~ b, Eq b) => a -> b -> Bool T9939.hs:21:1: warning: [-Wredundant-constraints] • Redundant constraint: Eq a • In the type signature for: - f4 :: (Eq a, Eq b) => a -> b -> Equal a b -> Bool + f4 :: forall a b. (Eq a, Eq b) => a -> b -> Equal a b -> Bool diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index 121d95f2d2..d36c58dd11 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -1,12 +1,12 @@ tc168.hs:17:1: error: - • Could not deduce (C a1 (a, b0)) - from the context: C a1 (a, b) + • Could not deduce (C a (a1, b0)) + from the context: C a (a1, b) bound by the inferred type for ‘g’: - C a1 (a, b) => a1 -> a + forall a a1 b. C a (a1, b) => a -> a1 at tc168.hs:17:1-16 The type variable ‘b0’ is ambiguous • In the ambiguity check for the inferred type for ‘g’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - g :: forall b a1 a2. C a2 (a1, b) => a2 -> a1 + g :: forall a1 a2 b. C a1 (a2, b) => a1 -> a2 diff --git a/testsuite/tests/typecheck/should_fail/ClassOperator.stderr b/testsuite/tests/typecheck/should_fail/ClassOperator.stderr index 30791286c2..890783d3c1 100644 --- a/testsuite/tests/typecheck/should_fail/ClassOperator.stderr +++ b/testsuite/tests/typecheck/should_fail/ClassOperator.stderr @@ -3,7 +3,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (**>) :: (a ><> b) => a -> a -> () + (**>) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘**>’ @@ -16,7 +16,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (**<) :: (a ><> b) => a -> a -> () + (**<) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘**<’ @@ -29,7 +29,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (>**) :: (a ><> b) => a -> a -> () + (>**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘>**’ @@ -42,7 +42,7 @@ ClassOperator.hs:12:3: error: • Could not deduce (a ><> b0) from the context: (a ><> b) bound by the type signature for: - (<**) :: (a ><> b) => a -> a -> () + (<**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:12:3-44 The type variable ‘b0’ is ambiguous • In the ambiguity check for ‘<**’ diff --git a/testsuite/tests/typecheck/should_fail/T10534.stderr b/testsuite/tests/typecheck/should_fail/T10534.stderr index ef42727c9e..86020af877 100644 --- a/testsuite/tests/typecheck/should_fail/T10534.stderr +++ b/testsuite/tests/typecheck/should_fail/T10534.stderr @@ -3,7 +3,7 @@ T10534a.hs:10:9: error: • Could not deduce: Coercible a b arising from a use of ‘coerce’ from the context: Coercible (DF a) (DF b) bound by the type signature for: - silly :: Coercible (DF a) (DF b) => a -> b + silly :: forall a b. Coercible (DF a) (DF b) => a -> b at T10534a.hs:9:1-42 ‘a’ is a rigid type variable bound by the type signature for: diff --git a/testsuite/tests/typecheck/should_fail/T11947a.stderr b/testsuite/tests/typecheck/should_fail/T11947a.stderr index 4f6a4a7505..9ca1da0ee0 100644 --- a/testsuite/tests/typecheck/should_fail/T11947a.stderr +++ b/testsuite/tests/typecheck/should_fail/T11947a.stderr @@ -3,7 +3,7 @@ T11947a.hs:4:19: error: • Could not deduce (RealFloat a0) from the context: RealFloat a bound by the type signature for: - theFloatDigits :: RealFloat a => Int + theFloatDigits :: forall a. RealFloat a => Int at T11947a.hs:4:19-46 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘theFloatDigits’ diff --git a/testsuite/tests/typecheck/should_fail/T11948.stderr b/testsuite/tests/typecheck/should_fail/T11948.stderr index 4e683f898a..457ac2af4f 100644 --- a/testsuite/tests/typecheck/should_fail/T11948.stderr +++ b/testsuite/tests/typecheck/should_fail/T11948.stderr @@ -3,7 +3,7 @@ T11948.hs:21:18: error: • Could not deduce (Bar (F zq) zq) arising from a use of ‘bar’ from the context: Bar (Foo (F zq)) (Foo zq) bound by the type signature for: - bug :: Bar (Foo (F zq)) (Foo zq) => Foo (F zq) -> Foo zq + bug :: forall zq. Bar (Foo (F zq)) (Foo zq) => Foo (F zq) -> Foo zq at T11948.hs:(19,1)-(20,38) • In the expression: bar sk :: Foo zq In an equation for ‘x’: x = bar sk :: Foo zq diff --git a/testsuite/tests/typecheck/should_fail/T12151.stderr b/testsuite/tests/typecheck/should_fail/T12151.stderr index 17d484e0ea..4b233d8b64 100644 --- a/testsuite/tests/typecheck/should_fail/T12151.stderr +++ b/testsuite/tests/typecheck/should_fail/T12151.stderr @@ -9,7 +9,7 @@ T12151.hs:9:13: error: • Could not deduce (Put a0) from the context: Put a bound by the type signature for: - put :: Put a => t + put :: forall a. Put a => forall t. t at T12151.hs:9:13-15 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘put’ diff --git a/testsuite/tests/typecheck/should_fail/T12918b.stderr b/testsuite/tests/typecheck/should_fail/T12918b.stderr index cc62c75aac..92aa85e9f3 100644 --- a/testsuite/tests/typecheck/should_fail/T12918b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12918b.stderr @@ -17,7 +17,7 @@ T12918b.hs:12:11: error: • Could not deduce (Foo1 a0) from the context: Foo1 a bound by the type signature for: - bar2 :: Foo1 a => x + bar2 :: forall a. Foo1 a => forall x. x at T12918b.hs:12:11-14 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bar2’ diff --git a/testsuite/tests/typecheck/should_fail/T1897a.stderr b/testsuite/tests/typecheck/should_fail/T1897a.stderr index e188a55598..61de72d6a6 100644 --- a/testsuite/tests/typecheck/should_fail/T1897a.stderr +++ b/testsuite/tests/typecheck/should_fail/T1897a.stderr @@ -3,7 +3,7 @@ T1897a.hs:9:1: error: • Could not deduce (Wob a0 b) from the context: Wob a b bound by the inferred type for ‘foo’: - Wob a b => b -> [b] + forall a b. Wob a b => b -> [b] at T1897a.hs:9:1-24 The type variable ‘a0’ is ambiguous • In the ambiguity check for the inferred type for ‘foo’ diff --git a/testsuite/tests/typecheck/should_fail/T2714.stderr b/testsuite/tests/typecheck/should_fail/T2714.stderr index c016586cc4..9b3fc34c52 100644 --- a/testsuite/tests/typecheck/should_fail/T2714.stderr +++ b/testsuite/tests/typecheck/should_fail/T2714.stderr @@ -1,10 +1,10 @@ T2714.hs:8:5: error: - • Couldn't match type ‘a’ with ‘f0 b’ - ‘a’ is a rigid type variable bound by + • Couldn't match type ‘c’ with ‘f0 (a -> b)’ + ‘c’ is a rigid type variable bound by the type signature for: - f :: forall a b. ((a -> b) -> b) -> forall c. c -> a - at T2714.hs:7:1-42 + f :: ((a -> b) -> b) -> forall c. c -> a + at T2714.hs:8:1-9 Expected type: ((a -> b) -> b) -> c -> a Actual type: ((a -> b) -> b) -> f0 (a -> b) -> f0 b • In the expression: ffmap diff --git a/testsuite/tests/typecheck/should_fail/T3592.stderr b/testsuite/tests/typecheck/should_fail/T3592.stderr index 7fe7f6d115..ab03985faa 100644 --- a/testsuite/tests/typecheck/should_fail/T3592.stderr +++ b/testsuite/tests/typecheck/should_fail/T3592.stderr @@ -4,7 +4,7 @@ T3592.hs:8:5: error: Possible fix: add (Show a) to the context of the type signature for: - f :: T a -> String + f :: forall a. T a -> String • In the expression: show In an equation for ‘f’: f = show @@ -13,6 +13,6 @@ T3592.hs:11:7: error: Possible fix: add (Show a) to the context of the type signature for: - g :: T a -> String + g :: forall a. T a -> String • In the expression: show x In an equation for ‘g’: g x = show x diff --git a/testsuite/tests/typecheck/should_fail/T5300.stderr b/testsuite/tests/typecheck/should_fail/T5300.stderr index 589da0a5c4..a80839455e 100644 --- a/testsuite/tests/typecheck/should_fail/T5300.stderr +++ b/testsuite/tests/typecheck/should_fail/T5300.stderr @@ -3,7 +3,9 @@ T5300.hs:11:7: error: • Could not deduce (C1 a b c0) from the context: (Monad m, C1 a b c) bound by the type signature for: - f1 :: (Monad m, C1 a b c) => a -> StateT (T b) m a + f1 :: forall (m :: * -> *) a b c. + (Monad m, C1 a b c) => + a -> StateT (T b) m a at T5300.hs:11:7-50 The type variable ‘c0’ is ambiguous • In the ambiguity check for ‘f1’ @@ -15,7 +17,8 @@ T5300.hs:14:7: error: • Could not deduce (C1 a1 b1 c10) from the context: (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) bound by the type signature for: - f2 :: (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) => + f2 :: forall (m :: * -> *) a1 b1 c1 a2 b2 c2. + (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) => a1 -> StateT (T b2) m a2 at T5300.hs:14:7-69 The type variable ‘c10’ is ambiguous diff --git a/testsuite/tests/typecheck/should_fail/T7279.stderr b/testsuite/tests/typecheck/should_fail/T7279.stderr index 1825bca574..eed8878170 100644 --- a/testsuite/tests/typecheck/should_fail/T7279.stderr +++ b/testsuite/tests/typecheck/should_fail/T7279.stderr @@ -3,7 +3,7 @@ T7279.hs:6:10: error: • Could not deduce (Show b0) from the context: (Eq a, Show b) bound by an instance declaration: - (Eq a, Show b) => Eq (T a) + forall a b. (Eq a, Show b) => Eq (T a) at T7279.hs:6:10-35 The type variable ‘b0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/typecheck/should_fail/T7437.stderr b/testsuite/tests/typecheck/should_fail/T7437.stderr index d305cee426..d6663df40e 100644 --- a/testsuite/tests/typecheck/should_fail/T7437.stderr +++ b/testsuite/tests/typecheck/should_fail/T7437.stderr @@ -11,7 +11,9 @@ T7437.hs:14:13: error: • Could not deduce (Put a0) from the context: (Put a, Generic t, GPut (Rep t)) bound by the type signature for: - put :: (Put a, Generic t, GPut (Rep t)) => t -> [()] + put :: forall a. + Put a => + forall t. (Generic t, GPut (Rep t)) => t -> [()] at T7437.hs:14:13-15 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘put’ diff --git a/testsuite/tests/typecheck/should_fail/T7453.stderr b/testsuite/tests/typecheck/should_fail/T7453.stderr index 9157e116f5..518d6fad05 100644 --- a/testsuite/tests/typecheck/should_fail/T7453.stderr +++ b/testsuite/tests/typecheck/should_fail/T7453.stderr @@ -4,7 +4,7 @@ T7453.hs:9:15: error: because type variable ‘t’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: Id t + z :: forall t. Id t at T7453.hs:8:11-19 Expected type: Id t Actual type: Id p @@ -32,7 +32,7 @@ T7453.hs:15:15: error: because type variable ‘t1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: () -> t1 + z :: forall t1. () -> t1 at T7453.hs:14:11-22 Expected type: () -> t1 Actual type: () -> p @@ -60,7 +60,7 @@ T7453.hs:21:15: error: because type variable ‘t1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: t1 + z :: forall t1. t1 at T7453.hs:20:11-16 • In the expression: v In an equation for ‘z’: diff --git a/testsuite/tests/typecheck/should_fail/T7869.stderr b/testsuite/tests/typecheck/should_fail/T7869.stderr index 00ea8e7438..4cf1cfaf67 100644 --- a/testsuite/tests/typecheck/should_fail/T7869.stderr +++ b/testsuite/tests/typecheck/should_fail/T7869.stderr @@ -4,7 +4,7 @@ T7869.hs:3:12: error: because type variable ‘b1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - [a1] -> b1 + forall a1 b1. [a1] -> b1 at T7869.hs:3:20-27 Expected type: [a1] -> b1 Actual type: [a] -> b diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.stderr b/testsuite/tests/typecheck/should_fail/tcfail032.stderr index d2912b2b94..14be02dc45 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail032.stderr @@ -4,7 +4,7 @@ tcfail032.hs:14:8: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - Eq a1 => a1 -> Int + forall a1. Eq a1 => a1 -> Int at tcfail032.hs:14:13-30 • In the expression: (x :: (Eq a) => a -> Int) In an equation for ‘f’: f x = (x :: (Eq a) => a -> Int) diff --git a/testsuite/tests/typecheck/should_fail/tcfail034.stderr b/testsuite/tests/typecheck/should_fail/tcfail034.stderr index baf68da924..9158fd2014 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail034.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail034.stderr @@ -3,12 +3,12 @@ tcfail034.hs:17:11: error: • Could not deduce (Integral a) arising from a use of ‘mod’ from the context: (Num a, Eq a) bound by the type signature for: - test :: (Num a, Eq a) => a -> Bool + test :: forall a. (Num a, Eq a) => a -> Bool at tcfail034.hs:16:1-32 Possible fix: add (Integral a) to the context of the type signature for: - test :: (Num a, Eq a) => a -> Bool + test :: forall a. (Num a, Eq a) => a -> Bool • In the first argument of ‘(==)’, namely ‘(x `mod` 3)’ In the expression: (x `mod` 3) == 0 In an equation for ‘test’: test x = (x `mod` 3) == 0 diff --git a/testsuite/tests/typecheck/should_fail/tcfail067.stderr b/testsuite/tests/typecheck/should_fail/tcfail067.stderr index df7e0248c9..8ffb02faf0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail067.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail067.stderr @@ -7,7 +7,7 @@ tcfail067.hs:12:16: error: Possible fix: add (Ord a) to the context of the type signature for: - subRangeValue :: SubRange a -> a + subRangeValue :: forall a. SubRange a -> a • In the pattern: SubRange (lower, upper) value In an equation for ‘subRangeValue’: subRangeValue (SubRange (lower, upper) value) = value @@ -17,7 +17,7 @@ tcfail067.hs:15:11: error: Possible fix: add (Ord a) to the context of the type signature for: - subRange :: SubRange a -> (a, a) + subRange :: forall a. SubRange a -> (a, a) • In the pattern: SubRange r value In an equation for ‘subRange’: subRange (SubRange r value) = r @@ -25,12 +25,12 @@ tcfail067.hs:46:12: error: • Could not deduce (Ord a) arising from a use of ‘SubRange’ from the context: Show a bound by the type signature for: - showRange :: Show a => SubRange a -> String + showRange :: forall a. Show a => SubRange a -> String at tcfail067.hs:45:1-43 Possible fix: add (Ord a) to the context of the type signature for: - showRange :: Show a => SubRange a -> String + showRange :: forall a. Show a => SubRange a -> String • In the pattern: SubRange (lower, upper) value In an equation for ‘showRange’: showRange (SubRange (lower, upper) value) @@ -64,13 +64,15 @@ tcfail067.hs:74:5: error: • Could not deduce (Ord a) arising from a use of ‘SubRange’ from the context: Num a bound by the type signature for: - numSubRangeBinOp :: Num a => + numSubRangeBinOp :: forall a. + Num a => (a -> a -> a) -> SubRange a -> SubRange a -> SubRange a at tcfail067.hs:(71,1)-(72,58) Possible fix: add (Ord a) to the context of the type signature for: - numSubRangeBinOp :: Num a => + numSubRangeBinOp :: forall a. + Num a => (a -> a -> a) -> SubRange a -> SubRange a -> SubRange a • In the expression: SubRange (result, result) result In an equation for ‘numSubRangeBinOp’: diff --git a/testsuite/tests/typecheck/should_fail/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr index 1d005be670..15c4556480 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr @@ -3,7 +3,7 @@ tcfail072.hs:23:13: error: • Could not deduce (Ord p0) arising from a use of ‘g’ from the context: (Ord p, Ord q) bound by the type signature for: - g :: (Ord p, Ord q) => AB p q -> Bool + g :: forall p q. (Ord p, Ord q) => AB p q -> Bool at tcfail072.hs:22:1-38 The type variable ‘p0’ is ambiguous These potential instances exist: diff --git a/testsuite/tests/typecheck/should_fail/tcfail080.stderr b/testsuite/tests/typecheck/should_fail/tcfail080.stderr index 68e120232e..2fd7240182 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail080.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail080.stderr @@ -3,7 +3,7 @@ tcfail080.hs:27:1: error: • Could not deduce (Collection c0 a) from the context: Collection c a bound by the inferred type for ‘q’: - Collection c a => a -> Bool + forall (c :: * -> *) a. Collection c a => a -> Bool at tcfail080.hs:27:1-27 The type variable ‘c0’ is ambiguous • In the ambiguity check for the inferred type for ‘q’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail097.stderr b/testsuite/tests/typecheck/should_fail/tcfail097.stderr index f5940edaf2..bc8d9a0cf1 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail097.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail097.stderr @@ -3,10 +3,9 @@ tcfail097.hs:5:6: error: • Could not deduce (Eq a0) from the context: Eq a bound by the type signature for: - f :: Eq a => Int -> Int + f :: forall a. Eq a => Int -> Int at tcfail097.hs:5:6-23 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘f’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - f :: Eq a => Int -> Int + In the type signature: f :: Eq a => Int -> Int diff --git a/testsuite/tests/typecheck/should_fail/tcfail098.stderr b/testsuite/tests/typecheck/should_fail/tcfail098.stderr index bc59975806..503c3e3898 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail098.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail098.stderr @@ -3,7 +3,7 @@ tcfail098.hs:12:10: error: • Could not deduce (Bar a0) from the context: Bar a bound by an instance declaration: - Bar a => Bar Bool + forall a. Bar a => Bar Bool at tcfail098.hs:12:10-26 The type variable ‘a0’ is ambiguous • In the ambiguity check for an instance declaration diff --git a/testsuite/tests/typecheck/should_fail/tcfail102.stderr b/testsuite/tests/typecheck/should_fail/tcfail102.stderr index 7cf8b4fbcb..b7fd16d740 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail102.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail102.stderr @@ -6,7 +6,7 @@ tcfail102.hs:9:15: error: • Could not deduce (Integral (Ratio a)) arising from a use of ‘p’ from the context: Integral a bound by the type signature for: - f :: Integral a => P (Ratio a) -> P (Ratio a) + f :: forall a. Integral a => P (Ratio a) -> P (Ratio a) at tcfail102.hs:8:1-45 • In the ‘p’ field of a record In the expression: x {p = p x} diff --git a/testsuite/tests/typecheck/should_fail/tcfail116.stderr b/testsuite/tests/typecheck/should_fail/tcfail116.stderr index 48976d17ae..952512686e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail116.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail116.stderr @@ -3,7 +3,7 @@ tcfail116.hs:6:5: error: • Could not deduce (Foo a0) from the context: Foo a bound by the type signature for: - bug :: Foo a => () + bug :: forall a. Foo a => () at tcfail116.hs:6:5-13 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bug’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail125.stderr b/testsuite/tests/typecheck/should_fail/tcfail125.stderr index 7946e88932..7fe5275d8f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail125.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail125.stderr @@ -7,6 +7,6 @@ tcfail125.hs:11:4: error: Possible fix: add (Show a) to the context of the type signature for: - f :: Obs a -> String + f :: forall a. Obs a -> String • In the pattern: LiftObs _ _ In an equation for ‘f’: f (LiftObs _ _) = "yes" diff --git a/testsuite/tests/typecheck/should_fail/tcfail142.stderr b/testsuite/tests/typecheck/should_fail/tcfail142.stderr index 3f52ef5f80..ac36ffb5e0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail142.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail142.stderr @@ -3,10 +3,9 @@ tcfail142.hs:18:8: error: • Could not deduce (Bar a0 r) from the context: Bar a r bound by the type signature for: - bar :: Bar a r => r -> () + bar :: forall a r. Bar a r => r -> () at tcfail142.hs:18:8-25 The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘bar’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: - bar :: Bar a r => r -> () + In the type signature: bar :: Bar a r => r -> () diff --git a/testsuite/tests/typecheck/should_fail/tcfail171.stderr b/testsuite/tests/typecheck/should_fail/tcfail171.stderr index 076a3394d4..e5e90903bb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail171.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail171.stderr @@ -4,6 +4,6 @@ tcfail171.hs:9:10: error: Possible fix: add (PrintfArg a) to the context of the type signature for: - phex :: a -> b + phex :: forall a b. a -> b • In the expression: printf "0x%x" x In an equation for ‘phex’: phex x = printf "0x%x" x diff --git a/testsuite/tests/typecheck/should_fail/tcfail198.stderr b/testsuite/tests/typecheck/should_fail/tcfail198.stderr index 373c570863..e8c3852b1c 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail198.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail198.stderr @@ -4,7 +4,7 @@ tcfail198.hs:6:36: error: because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - a1 + forall a1. a1 at tcfail198.hs:6:41 • In the expression: x :: a In the second argument of ‘(++)’, namely ‘[x :: a]’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail208.stderr b/testsuite/tests/typecheck/should_fail/tcfail208.stderr index 45642a7548..d8b48cf2eb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail208.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail208.stderr @@ -3,7 +3,7 @@ tcfail208.hs:4:10: error: • Could not deduce (Eq (m a)) arising from a use of ‘==’ from the context: (Monad m, Eq a) bound by the type signature for: - f :: (Monad m, Eq a) => a -> m a -> Bool + f :: forall (m :: * -> *) a. (Monad m, Eq a) => a -> m a -> Bool at tcfail208.hs:3:1-40 • In the expression: (return x == y) In an equation for ‘f’: f x y = (return x == y) diff --git a/testsuite/tests/warnings/should_compile/PluralS.stderr b/testsuite/tests/warnings/should_compile/PluralS.stderr index 416ebb815b..d03efa5ad6 100644 --- a/testsuite/tests/warnings/should_compile/PluralS.stderr +++ b/testsuite/tests/warnings/should_compile/PluralS.stderr @@ -17,9 +17,11 @@ PluralS.hs:17:24: warning: [-Wtype-defaults (in -Wall)] PluralS.hs:23:1: warning: [-Wredundant-constraints] • Redundant constraint: Num a • In the type signature for: - redundantNum :: (Num a, Num a) => a + redundantNum :: forall a. (Num a, Num a) => a PluralS.hs:26:1: warning: [-Wredundant-constraints] • Redundant constraints: (Show a, Num a, Eq a, Eq a) • In the type signature for: - redundantMultiple :: (Num a, Show a, Num a, Eq a, Eq a) => a + redundantMultiple :: forall a. + (Num a, Show a, Num a, Eq a, Eq a) => + a diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr index b59b49c869..571a24119a 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -5,12 +5,12 @@ WCompatWarningsOn.hs:13:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) (this will become an error in a future GHC release) from the context: Monad m bound by the type signature for: - monadFail :: Monad m => m a + monadFail :: forall (m :: * -> *) a. Monad m => m a at WCompatWarningsOn.hs:11:1-27 Possible fix: add (Control.Monad.Fail.MonadFail m) to the context of the type signature for: - monadFail :: Monad m => m a + monadFail :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just _ <- undefined In the expression: do Just _ <- undefined |