diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2015-12-24 14:33:19 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2015-12-24 14:37:39 -0500 |
commit | 2db18b8135335da2da9918b722699df684097be9 (patch) | |
tree | 660dd90916aa6568694bbe39cdab83c7af98c5d7 /testsuite/tests/typecheck | |
parent | 48db13d279d592ed3044cbaf3513854bcb0d3dce (diff) | |
download | haskell-2db18b8135335da2da9918b722699df684097be9.tar.gz |
Visible type application
This re-working of the typechecker algorithm is based on
the paper "Visible type application", by Richard Eisenberg,
Stephanie Weirich, and Hamidhasan Ahmed, to be published at
ESOP'16.
This patch introduces -XTypeApplications, which allows users
to say, for example `id @Int`, which has type `Int -> Int`. See
the changes to the user manual for details.
This patch addresses tickets #10619, #5296, #10589.
Diffstat (limited to 'testsuite/tests/typecheck')
99 files changed, 1196 insertions, 841 deletions
diff --git a/testsuite/tests/typecheck/bug1465/bug1465.stderr b/testsuite/tests/typecheck/bug1465/bug1465.stderr index 1c67068762..4e31c7f195 100644 --- a/testsuite/tests/typecheck/bug1465/bug1465.stderr +++ b/testsuite/tests/typecheck/bug1465/bug1465.stderr @@ -6,3 +6,4 @@ C.hs:6:11: error: ‘bug1465-1.0:A.T’ is defined in ‘A’ in package ‘bug1465-1.0’ In the expression: B2.f In the expression: [B1.f, B2.f] + In an equation for ‘x’: x = [B1.f, B2.f] diff --git a/testsuite/tests/typecheck/should_compile/FD1.stderr b/testsuite/tests/typecheck/should_compile/FD1.stderr index 19d698294a..395217af8b 100644 --- a/testsuite/tests/typecheck/should_compile/FD1.stderr +++ b/testsuite/tests/typecheck/should_compile/FD1.stderr @@ -1,6 +1,6 @@ FD1.hs:16:1: error: - • Couldn't match expected type ‘Int -> Int’ with actual type ‘a’ + • Couldn't match expected type ‘a’ with actual type ‘Int -> Int’ ‘a’ is a rigid type variable bound by the type signature for: plus :: forall a. E a (Int -> Int) => Int -> a diff --git a/testsuite/tests/typecheck/should_compile/FD2.stderr b/testsuite/tests/typecheck/should_compile/FD2.stderr index 93997c52ec..ff3a923988 100644 --- a/testsuite/tests/typecheck/should_compile/FD2.stderr +++ b/testsuite/tests/typecheck/should_compile/FD2.stderr @@ -1,15 +1,16 @@ -FD2.hs:26:34: error: - • Couldn't match expected type ‘e1’ with actual type ‘e’ - ‘e’ is a rigid type variable bound by - the type signature for: - foldr1 :: forall e. Elem a e => (e -> e -> e) -> a -> e - at FD2.hs:21:13 +FD2.hs:26:36: error: + • Couldn't match expected type ‘e’ with actual type ‘e1’ ‘e1’ is a rigid type variable bound by the type signature for: mf :: forall e1. Elem a e1 => e1 -> Maybe e1 -> Maybe e1 at FD2.hs:24:18 - • In the first argument of ‘Just’, namely ‘(f x y)’ + ‘e’ is a rigid type variable bound by + the type signature for: + foldr1 :: forall e. Elem a e => (e -> e -> e) -> a -> e + at FD2.hs:21:13 + • In the first argument of ‘f’, namely ‘x’ + In the first argument of ‘Just’, namely ‘(f x y)’ In the expression: Just (f x y) • Relevant bindings include y :: e1 (bound at FD2.hs:26:23) diff --git a/testsuite/tests/typecheck/should_compile/PushHRIf.hs b/testsuite/tests/typecheck/should_compile/PushHRIf.hs new file mode 100644 index 0000000000..f6839133a0 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/PushHRIf.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} + +module PushHRIf where + +foo = (if True then id else id) :: forall a. a -> a + +bar = (foo 'x', foo True) diff --git a/testsuite/tests/typecheck/should_compile/T10072.stderr b/testsuite/tests/typecheck/should_compile/T10072.stderr index ba15398874..eb14ad8de5 100644 --- a/testsuite/tests/typecheck/should_compile/T10072.stderr +++ b/testsuite/tests/typecheck/should_compile/T10072.stderr @@ -1,8 +1,8 @@ -
-T10072.hs:3:31: error:
- Found type wildcard ‘_’ standing for ‘b’
- Where: ‘b’ is a rigid type variable bound by
- the RULE "map/empty" at T10072.hs:3:1
- To use the inferred type, enable PartialTypeSignatures
- In a RULE for ‘f’: a -> _
- When checking the transformation rule "map/empty"
+ +T10072.hs:3:31: error: + • Found type wildcard ‘_’ standing for ‘b’ + Where: ‘b’ is a rigid type variable bound by + the RULE "map/empty" at T10072.hs:3:1 + To use the inferred type, enable PartialTypeSignatures + • In a RULE for ‘f’: a -> _ + When checking the transformation rule "map/empty" diff --git a/testsuite/tests/typecheck/should_compile/T10971a.stderr b/testsuite/tests/typecheck/should_compile/T10971a.stderr index 7ca7680c52..eea8a11ea3 100644 --- a/testsuite/tests/typecheck/should_compile/T10971a.stderr +++ b/testsuite/tests/typecheck/should_compile/T10971a.stderr @@ -34,9 +34,9 @@ T10971a.hs:9:6: warning: T10971a.hs:9:31: warning: • Defaulting the following constraints to type ‘[]’ - (Foldable t0) arising from a use of ‘length’ at T10971a.hs:9:31-36 + (Foldable t0) arising from a use of ‘length’ at T10971a.hs:9:31-38 (Traversable t0) - arising from a use of ‘fmapDefault’ at T10971a.hs:9:14-24 + arising from a use of ‘fmapDefault’ at T10971a.hs:9:14-28 • In the expression: length x In the expression: (fmapDefault f x, length x) In the expression: \ f x -> (fmapDefault f x, length x) diff --git a/testsuite/tests/typecheck/should_compile/T2494.stderr b/testsuite/tests/typecheck/should_compile/T2494.stderr index 71351cba0a..b398459aa9 100644 --- a/testsuite/tests/typecheck/should_compile/T2494.stderr +++ b/testsuite/tests/typecheck/should_compile/T2494.stderr @@ -1,34 +1,36 @@ -T2494.hs:15:14: - Couldn't match type ‘b’ with ‘a’ +T2494.hs:15:14: error: + • Couldn't match type ‘b’ with ‘a’ ‘b’ is a rigid type variable bound by - the RULE "foo/foo" at T2494.hs:14:16 + the RULE "foo/foo" at T2494.hs:14:16 ‘a’ is a rigid type variable bound by - the RULE "foo/foo" at T2494.hs:13:16 - Expected type: Maybe (m a) -> Maybe (m a) - Actual type: Maybe (m b) -> Maybe (m b) - In the first argument of ‘foo’, namely ‘g’ - In the second argument of ‘foo’, namely ‘(foo g x)’ - Relevant bindings include - f :: forall (m :: * -> *). Monad m => Maybe (m a) -> Maybe (m a) - (bound at T2494.hs:13:11) - g :: forall (m :: * -> *). Monad m => Maybe (m b) -> Maybe (m b) - (bound at T2494.hs:14:11) - x :: Maybe a (bound at T2494.hs:14:65) + the RULE "foo/foo" at T2494.hs:13:16 + Expected type: Maybe (m a) -> Maybe (m a) + Actual type: Maybe (m b) -> Maybe (m b) + • In the first argument of ‘foo’, namely ‘g’ + In the second argument of ‘foo’, namely ‘(foo g x)’ + In the expression: foo f (foo g x) + • Relevant bindings include + f :: forall (m :: * -> *). Monad m => Maybe (m a) -> Maybe (m a) + (bound at T2494.hs:13:11) + g :: forall (m :: * -> *). Monad m => Maybe (m b) -> Maybe (m b) + (bound at T2494.hs:14:11) + x :: Maybe a (bound at T2494.hs:14:65) -T2494.hs:15:30: - Couldn't match type ‘b’ with ‘a’ +T2494.hs:15:30: error: + • Couldn't match type ‘b’ with ‘a’ ‘b’ is a rigid type variable bound by - the RULE "foo/foo" at T2494.hs:14:16 + the RULE "foo/foo" at T2494.hs:14:16 ‘a’ is a rigid type variable bound by - the RULE "foo/foo" at T2494.hs:13:16 - Expected type: Maybe (m a) -> Maybe (m a) - Actual type: Maybe (m b) -> Maybe (m b) - In the second argument of ‘(.)’, namely ‘g’ - In the first argument of ‘foo’, namely ‘(f . g)’ - Relevant bindings include - f :: forall (m :: * -> *). Monad m => Maybe (m a) -> Maybe (m a) - (bound at T2494.hs:13:11) - g :: forall (m :: * -> *). Monad m => Maybe (m b) -> Maybe (m b) - (bound at T2494.hs:14:11) - x :: Maybe a (bound at T2494.hs:14:65) + the RULE "foo/foo" at T2494.hs:13:16 + Expected type: Maybe (m b) -> Maybe (m a) + Actual type: Maybe (m b) -> Maybe (m b) + • In the second argument of ‘(.)’, namely ‘g’ + In the first argument of ‘foo’, namely ‘(f . g)’ + In the expression: foo (f . g) x + • Relevant bindings include + f :: forall (m :: * -> *). Monad m => Maybe (m a) -> Maybe (m a) + (bound at T2494.hs:13:11) + g :: forall (m :: * -> *). Monad m => Maybe (m b) -> Maybe (m b) + (bound at T2494.hs:14:11) + x :: Maybe a (bound at T2494.hs:14:65) diff --git a/testsuite/tests/typecheck/should_compile/Vta1.hs b/testsuite/tests/typecheck/should_compile/Vta1.hs new file mode 100644 index 0000000000..c3ba43de54 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/Vta1.hs @@ -0,0 +1,95 @@ +{-# LANGUAGE TypeApplications, ScopedTypeVariables, PolyKinds, + TypeFamilies, RankNTypes, + FlexibleContexts #-} +-- tests about visible type application + +module Vta1 where + +quad :: a -> b -> c -> d -> (a, b, c, d) +quad = (,,,) + +silly = quad @_ @Bool @Char @_ 5 True 'a' "Hello" + +pairup_nosig x y = (x, y) + +pairup_sig :: a -> b -> (a,b) +pairup_sig u w = (u, w) + +answer_sig = pairup_sig @Bool @Int False 7 -- +-- (False, 7) :: (Bool, Int) + +answer_read = show (read @Int "3") -- "3" :: String +answer_show = show @Integer (read "5") -- "5" :: String +answer_showread = show @Int (read @Int "7") -- "7" :: String + +intcons a = (:) @Int a + +intpair x y = pairup_sig @Int x y + +answer_pairup = pairup_sig @Int 5 True -- (5, True) :: (Int, Bool) +answer_intpair = intpair 1 "hello" -- (1, "hello") :: (Int, String) +answer_intcons = intcons 7 [] -- [7] :: [Int] + +type family F a +type instance F Char = Bool + +g :: F a -> a +g _ = undefined + +f :: Char +f = g True + +answer = g @Char False + +mapSame :: forall b. (forall a. a -> a) -> [b] -> [b] +mapSame _ [] = [] +mapSame fun (x:xs) = fun @b x : (mapSame @b fun xs) + +pair :: forall a. a-> (forall b. b -> (a, b)) +pair x y = (x, y) + +b = pair @Int 3 @Bool True +c = mapSame id [1,2,3] +d = pair 3 @Bool True + +pairnum :: forall a. Num a => forall b. b -> (a, b) +pairnum = pair 3 + +e = (pair 3 :: forall a. Num a => forall b. b -> (a, b)) @Int @Bool True +h = pairnum @Int @Bool True + +data First (a :: * -> *) = F +data Proxy (a :: k) = P -- This expands to P (kind variable) (type variable) +data Three (a :: * -> k -> *) = T + +foo :: Proxy a -> Int +foo _ = 0 + +first :: First a -> Int +first _ = 0 + +fTest = first F +fMaybe = first @Maybe F + +test = foo P +bar = foo @Bool P -- should work + +too :: Three a -> Int +too _ = 3 + +threeBase = too T +threeOk = too @Either T + +blah = Nothing @Int + +newtype N = MkN { unMkN :: forall a. Show a => a -> String } + +n = MkN show + +boo = unMkN n @Bool + +boo2 :: forall (a :: * -> *) . Proxy a -> Bool +boo2 _ = False + +base = boo2 P +bar'= boo2 @Maybe P -- should work diff --git a/testsuite/tests/typecheck/should_compile/Vta2.hs b/testsuite/tests/typecheck/should_compile/Vta2.hs new file mode 100644 index 0000000000..2851b06469 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/Vta2.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE RankNTypes, TypeApplications #-} + + +module Vta2 where + +checkIf :: Bool -> (forall a. a -> a) -> (Bool, Int) +checkIf _ = if True + then \f -> (f True, f 5) + else \f -> (f False, f @Int 3) + +checkCase :: Bool -> (forall a. a -> a) -> (Bool, Int) +checkCase _ = case True of + True -> \f -> (f True, f 5) + False -> \f -> (f False, f @Int 3) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index a969a4c6ac..8002299fb1 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -471,6 +471,9 @@ test('T10428', normal, compile, ['']) test('RepArrow', normal, compile, ['']) test('T10562', normal, compile, ['']) test('T10564', normal, compile, ['']) +test('Vta1', normal, compile, ['']) +test('Vta2', normal, compile, ['']) +test('PushHRIf', normal, compile, ['']) test('T10632', normal, compile, ['']) test('T10642', normal, compile, ['']) test('T10744', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr index 5cb341709e..8551f66c3b 100644 --- a/testsuite/tests/typecheck/should_compile/holes.stderr +++ b/testsuite/tests/typecheck/should_compile/holes.stderr @@ -1,33 +1,33 @@ -
-holes.hs:3:5: warning:
- Found hole: _ :: t
- Where: ‘t’ is a rigid type variable bound by
- the inferred type of f :: t at holes.hs:3:1
- In the expression: _
- In an equation for ‘f’: f = _
- Relevant bindings include f :: t (bound at holes.hs:3:1)
-
-holes.hs:6:7: warning:
- Found hole: _ :: Char
- In the expression: _
- In an equation for ‘g’: g x = _
- Relevant bindings include
- x :: Int (bound at holes.hs:6:3)
- g :: Int -> Char (bound at holes.hs:6:1)
-
-holes.hs:8:5: warning:
- Found hole: _ :: [Char]
- In the first argument of ‘(++)’, namely ‘_’
- In the expression: _ ++ "a"
- In an equation for ‘h’: h = _ ++ "a"
- Relevant bindings include h :: [Char] (bound at holes.hs:8:1)
-
-holes.hs:11:15: warning:
- Found hole: _ :: b0
- Where: ‘b0’ is an ambiguous type variable
- In the second argument of ‘const’, namely ‘_’
- In the expression: const y _
- In an equation for ‘z’: z y = const y _
- Relevant bindings include
- y :: [a] (bound at holes.hs:11:3)
- z :: [a] -> [a] (bound at holes.hs:11:1)
+ +holes.hs:3:5: warning: + • Found hole: _ :: t + Where: ‘t’ is a rigid type variable bound by + the inferred type of f :: t at holes.hs:3:1 + • In the expression: _ + In an equation for ‘f’: f = _ + • Relevant bindings include f :: t (bound at holes.hs:3:1) + +holes.hs:6:7: warning: + • Found hole: _ :: Char + • In the expression: _ + In an equation for ‘g’: g x = _ + • Relevant bindings include + x :: Int (bound at holes.hs:6:3) + g :: Int -> Char (bound at holes.hs:6:1) + +holes.hs:8:5: warning: + • Found hole: _ :: [Char] + • In the first argument of ‘(++)’, namely ‘_’ + In the expression: _ ++ "a" + In an equation for ‘h’: h = _ ++ "a" + • Relevant bindings include h :: [Char] (bound at holes.hs:8:1) + +holes.hs:11:15: warning: + • Found hole: _ :: b0 + Where: ‘b0’ is an ambiguous type variable + • In the second argument of ‘const’, namely ‘_’ + In the expression: const y _ + In an equation for ‘z’: z y = const y _ + • Relevant bindings include + y :: [a] (bound at holes.hs:11:3) + z :: [a] -> [a] (bound at holes.hs:11:1) diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr index a6e7c6194e..2d1261b278 100644 --- a/testsuite/tests/typecheck/should_compile/holes3.stderr +++ b/testsuite/tests/typecheck/should_compile/holes3.stderr @@ -1,36 +1,36 @@ -
-holes3.hs:3:5: error:
- Found hole: _ :: t
- Where: ‘t’ is a rigid type variable bound by
- the inferred type of f :: t at holes3.hs:3:1
- In the expression: _
- In an equation for ‘f’: f = _
- Relevant bindings include f :: t (bound at holes3.hs:3:1)
-
-holes3.hs:6:7: error:
- Found hole: _gr :: Char
- Or perhaps ‘_gr’ is mis-spelled, or not in scope
- In the expression: _gr
- In an equation for ‘g’: g x = _gr
- Relevant bindings include
- x :: Int (bound at holes3.hs:6:3)
- g :: Int -> Char (bound at holes3.hs:6:1)
-
-holes3.hs:8:5: error:
- Found hole: _aa :: [Char]
- Or perhaps ‘_aa’ is mis-spelled, or not in scope
- In the first argument of ‘(++)’, namely ‘_aa’
- In the expression: _aa ++ "a"
- In an equation for ‘h’: h = _aa ++ "a"
- Relevant bindings include h :: [Char] (bound at holes3.hs:8:1)
-
-holes3.hs:11:15: error:
- Found hole: _x :: b0
- Where: ‘b0’ is an ambiguous type variable
- Or perhaps ‘_x’ is mis-spelled, or not in scope
- In the second argument of ‘const’, namely ‘_x’
- In the expression: const y _x
- In an equation for ‘z’: z y = const y _x
- Relevant bindings include
- y :: [a] (bound at holes3.hs:11:3)
- z :: [a] -> [a] (bound at holes3.hs:11:1)
+ +holes3.hs:3:5: error: + • Found hole: _ :: t + Where: ‘t’ is a rigid type variable bound by + the inferred type of f :: t at holes3.hs:3:1 + • In the expression: _ + In an equation for ‘f’: f = _ + • Relevant bindings include f :: t (bound at holes3.hs:3:1) + +holes3.hs:6:7: error: + • Found hole: _gr :: Char + Or perhaps ‘_gr’ is mis-spelled, or not in scope + • In the expression: _gr + In an equation for ‘g’: g x = _gr + • Relevant bindings include + x :: Int (bound at holes3.hs:6:3) + g :: Int -> Char (bound at holes3.hs:6:1) + +holes3.hs:8:5: error: + • Found hole: _aa :: [Char] + Or perhaps ‘_aa’ is mis-spelled, or not in scope + • In the first argument of ‘(++)’, namely ‘_aa’ + In the expression: _aa ++ "a" + In an equation for ‘h’: h = _aa ++ "a" + • Relevant bindings include h :: [Char] (bound at holes3.hs:8:1) + +holes3.hs:11:15: error: + • Found hole: _x :: b0 + Where: ‘b0’ is an ambiguous type variable + Or perhaps ‘_x’ is mis-spelled, or not in scope + • In the second argument of ‘const’, namely ‘_x’ + In the expression: const y _x + In an equation for ‘z’: z y = const y _x + • Relevant bindings include + y :: [a] (bound at holes3.hs:11:3) + z :: [a] -> [a] (bound at holes3.hs:11:1) diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index 96858b1d3c..e0de74c945 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -7,19 +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 ‘a’ - because type variable ‘a2’ would escape its scope + • Couldn't match expected type ‘a1’ with actual type ‘a’ + because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - a2 + a1 at tc141.hs:11:31-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 :: 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) + f :: (a, a) -> (t, a) (bound at tc141.hs:11:1) tc141.hs:13:13: error: • You cannot bind scoped type variable ‘a’ @@ -42,7 +43,12 @@ tc141.hs:15:18: error: at tc141.hs:14:14-19 • In the expression: b In an equation for ‘v’: v = b + In the expression: + let + v :: a + v = b + in v • Relevant bindings include v :: a1 (bound at tc141.hs:15:14) b :: r1 (bound at tc141.hs:13:5) - g :: r -> r1 -> a (bound at tc141.hs:13:1) + g :: r -> r1 -> forall a. a (bound at tc141.hs:13:1) diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index 7d992a48a0..16ba4b0446 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)
- bound by the inferred type for ‘g’:
- C a1 (a, b) => a1 -> a
- 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 a b a1. C a1 (a, b) => a1 -> a
+ +tc168.hs:17:1: error: + • Could not deduce (C a1 (a, b0)) + from the context: C a1 (a, b) + bound by the inferred type for ‘g’: + C a1 (a, b) => a1 -> a + 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 a b a1. C a1 (a, b) => a1 -> a diff --git a/testsuite/tests/typecheck/should_compile/tc211.stderr b/testsuite/tests/typecheck/should_compile/tc211.stderr index d802dffe4e..89c82c4f9a 100644 --- a/testsuite/tests/typecheck/should_compile/tc211.stderr +++ b/testsuite/tests/typecheck/should_compile/tc211.stderr @@ -1,61 +1,20 @@ -tc211.hs:17:8: error: - Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a2 -> a2’ - In the expression: - (:) :: - (forall a. a -> a) -> [forall a. a -> a] -> [forall a. a -> a] - In the expression: - ((:) :: - (forall a. a -> a) -> [forall a. a -> a] -> [forall a. a -> a]) - (head foo) foo - -tc211.hs:18:22: error: - Couldn't match type ‘forall a3. a3 -> a3’ with ‘a -> a’ - Expected type: [a -> a] - Actual type: [forall a. a -> a] - In the first argument of ‘head’, namely ‘foo’ - In the first argument of ‘(:) :: - (forall a. a -> a) - -> [forall a. a -> a] -> [forall a. a -> a]’, namely - ‘(head foo)’ - -tc211.hs:59:18: error: - Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a1 -> a1’ - In the expression: - Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - In an equation for ‘cons’: - cons - = Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - -tc211.hs:65:8: error: - Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a0 -> a0’ - In the expression: - Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - In the expression: - (Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a)) - (\ x -> x) Nil - tc211.hs:73:9: error: - Couldn't match type ‘forall a4. a4 -> a4’ with ‘a3 -> a3’ - Expected type: List (forall a. a -> a) - -> (forall a. a -> a) -> a3 -> a3 - Actual type: List (a3 -> a3) -> (a3 -> a3) -> a3 -> a3 - In the expression: - foo2 :: - List (forall a. a -> a) -> (forall a. a -> a) -> (forall a. a -> a) - In the expression: - (foo2 :: - List (forall a. a -> a) - -> (forall a. a -> a) -> (forall a. a -> a)) - xs1 (\ x -> x) + • Couldn't match type ‘forall a2. a2 -> a2’ with ‘a1 -> a1’ + Expected type: List (forall a. a -> a) + -> (forall a. a -> a) -> a1 -> a1 + Actual type: List (a1 -> a1) -> (a1 -> a1) -> a1 -> a1 + • In the expression: + foo2 :: + List (forall a. a -> a) -> (forall a. a -> a) -> (forall a. a -> a) + In the expression: + (foo2 :: + List (forall a. a -> a) + -> (forall a. a -> a) -> (forall a. a -> a)) + xs1 (\ x -> x) + In an equation for ‘bar4’: + bar4 + = (foo2 :: + List (forall a. a -> a) + -> (forall a. a -> a) -> (forall a. a -> a)) + xs1 (\ x -> x) diff --git a/testsuite/tests/typecheck/should_compile/tc243.stderr b/testsuite/tests/typecheck/should_compile/tc243.stderr index 98e0f5ae1e..0219817408 100644 --- a/testsuite/tests/typecheck/should_compile/tc243.stderr +++ b/testsuite/tests/typecheck/should_compile/tc243.stderr @@ -1,3 +1,3 @@ -tc243.hs:10:1: Warning: - Top-level binding with no type signature: (.+.) :: forall r. r +tc243.hs:10:1: warning: + Top-level binding with no type signature: (.+.) :: forall a. a diff --git a/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr b/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr index d95de09530..18c45a12c0 100644 --- a/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr +++ b/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr @@ -1,5 +1,5 @@ -CustomTypeErrors01.hs:12:11: error: - Values of type 'MyType' cannot be compared for equality. - In the expression: x == MyType - In an equation for ‘err’: err x = x == MyType +CustomTypeErrors01.hs:12:9: error: + • Values of type 'MyType' cannot be compared for equality. + • In the expression: x == MyType + In an equation for ‘err’: err x = x == MyType diff --git a/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr b/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr index 6ded98e0bd..49e262cd3c 100644 --- a/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr +++ b/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr @@ -1,9 +1,12 @@ + ExpandSynsFail2.hs:19:37: error: - Couldn't match type ‘Int’ with ‘Bool’ - Expected type: ST s Foo - Actual type: MyBarST s - Type synonyms expanded: - Expected type: ST s Int - Actual type: ST s Bool - In the first argument of ‘runST’, namely ‘barGen’ - In the second argument of ‘(==)’, namely ‘runST barGen’ + • Couldn't match type ‘Int’ with ‘Bool’ + Expected type: ST s Foo + Actual type: MyBarST s + Type synonyms expanded: + Expected type: ST s Int + Actual type: ST s Bool + • In the first argument of ‘runST’, namely ‘barGen’ + In the second argument of ‘(==)’, namely ‘runST barGen’ + In the first argument of ‘print’, namely + ‘(runST fooGen == runST barGen)’ diff --git a/testsuite/tests/typecheck/should_fail/T10495.stderr b/testsuite/tests/typecheck/should_fail/T10495.stderr index ee2060017e..e09e60af23 100644 --- a/testsuite/tests/typecheck/should_fail/T10495.stderr +++ b/testsuite/tests/typecheck/should_fail/T10495.stderr @@ -1,7 +1,8 @@ -T10495.hs:5:7: error: - Couldn't match representation of type ‘a0’ with that of ‘b0’ - arising from a use of ‘coerce’ - In the expression: coerce - In an equation for ‘foo’: foo = coerce - Relevant bindings include foo :: a0 -> b0 (bound at T10495.hs:5:1) +T10495.hs:5:1: error: + • Couldn't match representation of type ‘a0’ with that of ‘b0’ + arising from a use of ‘coerce’ + • When instantiating ‘foo’, initially inferred to have + this overly-general type: + forall a b. Coercible a b => a -> b + NB: This instantiation can be caused by the monomorphism restriction. diff --git a/testsuite/tests/typecheck/should_fail/T10971d.stderr b/testsuite/tests/typecheck/should_fail/T10971d.stderr index 244fff7098..c5ad886683 100644 --- a/testsuite/tests/typecheck/should_fail/T10971d.stderr +++ b/testsuite/tests/typecheck/should_fail/T10971d.stderr @@ -1,17 +1,20 @@ T10971d.hs:4:14: error: - Couldn't match expected type ‘[a0]’ - with actual type ‘Maybe Integer’ - In the first argument of ‘f’, namely ‘(Just 1)’ - In the second argument of ‘($)’, namely ‘f (Just 1)’ + • Couldn't match expected type ‘[a0]’ + with actual type ‘Maybe Integer’ + • In the first argument of ‘f’, namely ‘(Just 1)’ + In the second argument of ‘($)’, namely ‘f (Just 1)’ + In a stmt of a 'do' block: print $ f (Just 1) T10971d.hs:5:19: error: - Couldn't match expected type ‘[Integer]’ - with actual type ‘Maybe Integer’ - In the second argument of ‘g’, namely ‘(Just 5)’ - In the second argument of ‘($)’, namely ‘g (+ 1) (Just 5)’ + • Couldn't match expected type ‘[Integer]’ + with actual type ‘Maybe Integer’ + • In the second argument of ‘g’, namely ‘(Just 5)’ + In the second argument of ‘($)’, namely ‘g (+ 1) (Just 5)’ + In a stmt of a 'do' block: print $ g (+ 1) (Just 5) T10971d.hs:6:23: error: - Couldn't match expected type ‘[b0]’ with actual type ‘Maybe a1’ - In the second argument of ‘h’, namely ‘Nothing’ - In the second argument of ‘($)’, namely ‘h (const 5) Nothing’ + • Couldn't match expected type ‘[b0]’ with actual type ‘Maybe a1’ + • In the second argument of ‘h’, namely ‘Nothing’ + In the second argument of ‘($)’, namely ‘h (const 5) Nothing’ + In a stmt of a 'do' block: print $ h (const 5) Nothing diff --git a/testsuite/tests/typecheck/should_fail/T11274.stderr b/testsuite/tests/typecheck/should_fail/T11274.stderr index f73131704a..b6f1964c14 100644 --- a/testsuite/tests/typecheck/should_fail/T11274.stderr +++ b/testsuite/tests/typecheck/should_fail/T11274.stderr @@ -1,5 +1,5 @@ -T11274.hs:10:25: error: +T11274.hs:10:23: error: • No instance for (Eq Asd) arising from a use of ‘==’ • In the expression: x == y In an equation for ‘missingInstance’: missingInstance x y = x == y diff --git a/testsuite/tests/typecheck/should_fail/T1899.stderr b/testsuite/tests/typecheck/should_fail/T1899.stderr index 8c2964cfc6..c4db8fe1e7 100644 --- a/testsuite/tests/typecheck/should_fail/T1899.stderr +++ b/testsuite/tests/typecheck/should_fail/T1899.stderr @@ -9,6 +9,7 @@ T1899.hs:14:36: error: Actual type: [a] • In the first argument of ‘Auxiliary’, namely ‘varSet’ In the first argument of ‘Prop’, namely ‘(Auxiliary varSet)’ + In the expression: Prop (Auxiliary varSet) • Relevant bindings include varSet :: [a] (bound at T1899.hs:10:11) transRHS :: [a] -> Int -> Constraint a (bound at T1899.hs:10:2) diff --git a/testsuite/tests/typecheck/should_fail/T2414.stderr b/testsuite/tests/typecheck/should_fail/T2414.stderr index 0f797da713..bbbf5fce6a 100644 --- a/testsuite/tests/typecheck/should_fail/T2414.stderr +++ b/testsuite/tests/typecheck/should_fail/T2414.stderr @@ -1,7 +1,8 @@ -T2414.hs:9:13: - Occurs check: cannot construct the infinite type: b0 ~ (Bool, b0) - Expected type: b0 -> Maybe (Bool, b0) - Actual type: (Bool, b0) -> Maybe (Bool, b0) - In the first argument of ‘unfoldr’, namely ‘Just’ - In the expression: unfoldr Just +T2414.hs:9:13: error: + • Occurs check: cannot construct the infinite type: b0 ~ (Bool, b0) + Expected type: b0 -> Maybe (Bool, b0) + Actual type: (Bool, b0) -> Maybe (Bool, b0) + • In the first argument of ‘unfoldr’, namely ‘Just’ + In the expression: unfoldr Just + In an equation for ‘f’: f = unfoldr Just diff --git a/testsuite/tests/typecheck/should_fail/T2534.stderr b/testsuite/tests/typecheck/should_fail/T2534.stderr index fe6abae7b8..4e469f3cfd 100644 --- a/testsuite/tests/typecheck/should_fail/T2534.stderr +++ b/testsuite/tests/typecheck/should_fail/T2534.stderr @@ -1,8 +1,9 @@ -T2534.hs:3:13: - Couldn't match type ‘[b]’ with ‘a0 -> [b]’ - Expected type: [a0] -> [b] -> [b] - Actual type: [a0] -> (a0 -> [b]) -> [b] - In the first argument of ‘foldr’, namely ‘(>>=)’ - In the expression: foldr (>>=) [] [] - Relevant bindings include foo :: [b] (bound at T2534.hs:3:1) +T2534.hs:3:13: error: + • Couldn't match type ‘[b]’ with ‘a0 -> [b]’ + Expected type: [a0] -> [b] -> [b] + Actual type: [a0] -> (a0 -> [b]) -> [b] + • In the first argument of ‘foldr’, namely ‘(>>=)’ + In the expression: foldr (>>=) [] [] + In an equation for ‘foo’: foo = foldr (>>=) [] [] + • Relevant bindings include foo :: [b] (bound at T2534.hs:3:1) diff --git a/testsuite/tests/typecheck/should_fail/T2688.stderr b/testsuite/tests/typecheck/should_fail/T2688.stderr index 1915c41812..2b2ca0d22a 100644 --- a/testsuite/tests/typecheck/should_fail/T2688.stderr +++ b/testsuite/tests/typecheck/should_fail/T2688.stderr @@ -1,13 +1,13 @@ -T2688.hs:8:22: - Couldn't match expected type ‘v’ with actual type ‘s’ +T2688.hs:8:14: error: + • Couldn't match expected type ‘v’ with actual type ‘s’ ‘s’ is a rigid type variable bound by - the class declaration for ‘VectorSpace’ at T2688.hs:5:21 + the class declaration for ‘VectorSpace’ at T2688.hs:5:21 ‘v’ is a rigid type variable bound by - the class declaration for ‘VectorSpace’ at T2688.hs:5:19 - In the second argument of ‘(/)’, namely ‘s’ - In the second argument of ‘(*^)’, namely ‘(1 / s)’ - Relevant bindings include - s :: s (bound at T2688.hs:8:10) - v :: v (bound at T2688.hs:8:5) - (^/) :: v -> s -> v (bound at T2688.hs:8:5) + the class declaration for ‘VectorSpace’ at T2688.hs:5:19 + • In the expression: v *^ (1 / s) + In an equation for ‘^/’: v ^/ s = v *^ (1 / s) + • Relevant bindings include + s :: s (bound at T2688.hs:8:10) + v :: v (bound at T2688.hs:8:5) + (^/) :: v -> s -> v (bound at T2688.hs:8:5) diff --git a/testsuite/tests/typecheck/should_fail/T2846b.stderr b/testsuite/tests/typecheck/should_fail/T2846b.stderr index 0323283477..371d0ce5ca 100644 --- a/testsuite/tests/typecheck/should_fail/T2846b.stderr +++ b/testsuite/tests/typecheck/should_fail/T2846b.stderr @@ -1,6 +1,6 @@ T2846b.hs:5:5: error: - No instance for (Show (Num a0 => a0)) arising from a use of ‘show’ - (maybe you haven't applied a function to enough arguments?) - In the expression: show ([1, 2, 3] :: [Num a => a]) - In an equation for ‘f’: f = show ([1, 2, 3] :: [Num a => a]) + • No instance for (Show (forall a. [Num a => a])) + arising from a use of ‘show’ + • In the expression: show ([1, 2, 3] :: [Num a => a]) + In an equation for ‘f’: f = show ([1, 2, 3] :: [Num a => a]) diff --git a/testsuite/tests/typecheck/should_fail/T3102.stderr b/testsuite/tests/typecheck/should_fail/T3102.stderr index 925e80f7fc..a5a410efeb 100644 --- a/testsuite/tests/typecheck/should_fail/T3102.stderr +++ b/testsuite/tests/typecheck/should_fail/T3102.stderr @@ -1,11 +1,12 @@ -
-T3102.hs:11:12: error:
- Couldn't match type ‘a’ with ‘(?p::Int) => a0’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. a -> String
- at T3102.hs:11:10
- Expected type: a -> String
- Actual type: ((?p::Int) => a0) -> String
- In the first argument of ‘f’, namely ‘t’
- In the expression: f t
+ +T3102.hs:11:12: error: + • Couldn't match type ‘a’ with ‘(?p::Int) => a0’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. a -> String + at T3102.hs:11:10 + Expected type: a -> String + Actual type: ((?p::Int) => a0) -> String + • In the first argument of ‘f’, namely ‘t’ + In the expression: f t + In an equation for ‘result’: result = f t diff --git a/testsuite/tests/typecheck/should_fail/T3613.stderr b/testsuite/tests/typecheck/should_fail/T3613.stderr index f7fa6d4871..b7ffd671c8 100644 --- a/testsuite/tests/typecheck/should_fail/T3613.stderr +++ b/testsuite/tests/typecheck/should_fail/T3613.stderr @@ -1,14 +1,20 @@ -T3613.hs:14:20: - Couldn't match type ‘IO’ with ‘Maybe’ - Expected type: Maybe () - Actual type: IO () - In the first argument of ‘(>>)’, namely ‘bar’ - In the first argument of ‘fooThen’, namely ‘(bar >> undefined)’ +T3613.hs:14:20: error: + • Couldn't match type ‘IO’ with ‘Maybe’ + Expected type: Maybe b + Actual type: IO b + • In the first argument of ‘fooThen’, namely ‘(bar >> undefined)’ + In the expression: fooThen (bar >> undefined) + In the expression: + let fooThen m = foo >> m in fooThen (bar >> undefined) -T3613.hs:17:24: - Couldn't match expected type ‘Maybe a0’ with actual type ‘IO ()’ - In a stmt of a 'do' block: bar - In the first argument of ‘fooThen’, namely - ‘(do { bar; - undefined })’ +T3613.hs:17:24: error: + • Couldn't match expected type ‘Maybe a0’ with actual type ‘IO ()’ + • In a stmt of a 'do' block: bar + In the first argument of ‘fooThen’, namely + ‘(do { bar; + undefined })’ + In the expression: + fooThen + (do { bar; + undefined }) diff --git a/testsuite/tests/typecheck/should_fail/T3950.stderr b/testsuite/tests/typecheck/should_fail/T3950.stderr index fab70fd01b..ae50a74f3c 100644 --- a/testsuite/tests/typecheck/should_fail/T3950.stderr +++ b/testsuite/tests/typecheck/should_fail/T3950.stderr @@ -1,12 +1,17 @@ -T3950.hs:15:13: error: +T3950.hs:15:8: error: • Couldn't match kind ‘* -> *’ with ‘*’ When matching types w :: (* -> * -> *) -> * Sealed :: (* -> *) -> * - Expected type: w (Id p) - Actual type: Sealed (Id p x0) - • In the first argument of ‘Just’, namely ‘rp'’ - In the expression: Just rp' + Expected type: Maybe (w (Id p)) + Actual type: Maybe (Sealed (Id p x0)) + • In the expression: Just rp' + In an equation for ‘rp’: + rp _ + = Just rp' + where + rp' :: Sealed (Id p x) + rp' = undefined • Relevant bindings include rp :: Bool -> Maybe (w (Id p)) (bound at T3950.hs:15:1) diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index cc338e7afa..c284cda9d0 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -1,5 +1,5 @@ -T5095.hs:9:11: error: +T5095.hs:9:9: error: • Overlapping instances for Eq a arising from a use of ‘==’ Matching instances: instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31 diff --git a/testsuite/tests/typecheck/should_fail/T5689.stderr b/testsuite/tests/typecheck/should_fail/T5689.stderr index 6e3777d2ee..2c7eaa87d4 100644 --- a/testsuite/tests/typecheck/should_fail/T5689.stderr +++ b/testsuite/tests/typecheck/should_fail/T5689.stderr @@ -1,8 +1,10 @@ T5689.hs:10:36: error: - Couldn't match expected type ‘Bool’ with actual type ‘t’ - In the expression: v - In the expression: if v then False else True - Relevant bindings include - v :: t (bound at T5689.hs:10:28) - r :: IORef (t -> t) (bound at T5689.hs:7:14) + • Couldn't match expected type ‘Bool’ with actual type ‘t’ + • In the expression: v + In the expression: if v then False else True + In the second argument of ‘writeIORef’, namely + ‘(\ v -> if v then False else True)’ + • Relevant bindings include + v :: t (bound at T5689.hs:10:28) + r :: IORef (t -> t) (bound at T5689.hs:7:14) diff --git a/testsuite/tests/typecheck/should_fail/T5853.stderr b/testsuite/tests/typecheck/should_fail/T5853.stderr index 33ae4e16ce..ab2ad30d6c 100644 --- a/testsuite/tests/typecheck/should_fail/T5853.stderr +++ b/testsuite/tests/typecheck/should_fail/T5853.stderr @@ -1,5 +1,5 @@ -T5853.hs:15:52: error: +T5853.hs:15:46: error: • Could not deduce: Subst t2 (Elem t1) ~ t1 arising from a use of ‘<$>’ from the context: (F t, diff --git a/testsuite/tests/typecheck/should_fail/T6069.stderr b/testsuite/tests/typecheck/should_fail/T6069.stderr index eff2e8b5cf..e1c2e5653f 100644 --- a/testsuite/tests/typecheck/should_fail/T6069.stderr +++ b/testsuite/tests/typecheck/should_fail/T6069.stderr @@ -1,21 +1,24 @@ -T6069.hs:13:15: - Couldn't match type ‘ST s0 Int’ with ‘forall s. ST s a0’ - Expected type: ST s0 Int -> a0 - Actual type: (forall s. ST s a0) -> a0 - In the second argument of ‘(.)’, namely ‘runST’ - In the expression: print . runST +T6069.hs:13:15: error: + • Couldn't match type ‘ST s0 Int’ with ‘forall s. ST s a0’ + Expected type: ST s0 Int -> a0 + Actual type: (forall s. ST s a0) -> a0 + • In the second argument of ‘(.)’, namely ‘runST’ + In the expression: print . runST + In the expression: (print . runST) fourty_two -T6069.hs:14:15: - Couldn't match type ‘ST s1 Int’ with ‘forall s. ST s a1’ - Expected type: ST s1 Int -> a1 - Actual type: (forall s. ST s a1) -> a1 - In the second argument of ‘(.)’, namely ‘runST’ - In the expression: (print . runST) +T6069.hs:14:15: error: + • Couldn't match type ‘ST s1 Int’ with ‘forall s. ST s a1’ + Expected type: ST s1 Int -> a1 + Actual type: (forall s. ST s a1) -> a1 + • In the second argument of ‘(.)’, namely ‘runST’ + In the expression: (print . runST) + In the expression: (print . runST) $ fourty_two -T6069.hs:15:16: - Couldn't match type ‘ST s2 Int’ with ‘forall s. ST s a2’ - Expected type: ST s2 Int -> a2 - Actual type: (forall s. ST s a2) -> a2 - In the second argument of ‘(.)’, namely ‘runST’ - In the first argument of ‘($)’, namely ‘(print . runST)’ +T6069.hs:15:16: error: + • Couldn't match type ‘ST s2 Int’ with ‘forall s. ST s a2’ + Expected type: ST s2 Int -> a2 + Actual type: (forall s. ST s a2) -> a2 + • In the second argument of ‘(.)’, namely ‘runST’ + In the first argument of ‘($)’, namely ‘(print . runST)’ + In the expression: (print . runST) $ diff --git a/testsuite/tests/typecheck/should_fail/T7264.stderr b/testsuite/tests/typecheck/should_fail/T7264.stderr index 4b5b3557d9..b343d88cd1 100644 --- a/testsuite/tests/typecheck/should_fail/T7264.stderr +++ b/testsuite/tests/typecheck/should_fail/T7264.stderr @@ -1,12 +1,13 @@ -T7264.hs:13:19: - Couldn't match type ‘a’ with ‘forall r. r -> String’ +T7264.hs:13:19: error: + • Couldn't match type ‘a’ with ‘forall r. r -> String’ ‘a’ is a rigid type variable bound by - the inferred type of mkFoo2 :: a -> Maybe Foo at T7264.hs:13:1 - Expected type: a -> Foo - Actual type: (forall r. r -> String) -> Foo - In the first argument of ‘mmap’, namely ‘Foo’ - In the expression: mmap Foo (Just val) - Relevant bindings include - val :: a (bound at T7264.hs:13:8) - mkFoo2 :: a -> Maybe Foo (bound at T7264.hs:13:1) + the inferred type of mkFoo2 :: a -> Maybe Foo at T7264.hs:13:1 + Expected type: a -> Foo + Actual type: (forall r. r -> String) -> Foo + • In the first argument of ‘mmap’, namely ‘Foo’ + In the expression: mmap Foo (Just val) + In an equation for ‘mkFoo2’: mkFoo2 val = mmap Foo (Just val) + • Relevant bindings include + val :: a (bound at T7264.hs:13:8) + mkFoo2 :: a -> Maybe Foo (bound at T7264.hs:13:1) diff --git a/testsuite/tests/typecheck/should_fail/T7368.stderr b/testsuite/tests/typecheck/should_fail/T7368.stderr index 1c538ac7f9..f187aee61c 100644 --- a/testsuite/tests/typecheck/should_fail/T7368.stderr +++ b/testsuite/tests/typecheck/should_fail/T7368.stderr @@ -4,3 +4,4 @@ T7368.hs:3:10: error: When matching the kind of ‘Maybe’ • In the first argument of ‘b’, namely ‘(l Nothing)’ In the expression: b (l Nothing) + In an equation for ‘f’: f = b (l Nothing) diff --git a/testsuite/tests/typecheck/should_fail/T7453.stderr b/testsuite/tests/typecheck/should_fail/T7453.stderr index efbc7497e5..47bfa78754 100644 --- a/testsuite/tests/typecheck/should_fail/T7453.stderr +++ b/testsuite/tests/typecheck/should_fail/T7453.stderr @@ -13,6 +13,14 @@ T7453.hs:9:15: error: z = aux where aux = Id v + In an equation for ‘cast1’: + cast1 v + = runId z + where + z :: Id t + z = aux + where + aux = Id v • Relevant bindings include aux :: Id r (bound at T7453.hs:10:21) z :: Id t (bound at T7453.hs:9:11) @@ -33,6 +41,14 @@ T7453.hs:15:15: error: z = aux where aux = const v + In an equation for ‘cast2’: + cast2 v + = z () + where + z :: () -> t + z = aux + where + aux = const v • Relevant bindings include aux :: forall b. b -> r (bound at T7453.hs:16:21) z :: () -> t1 (bound at T7453.hs:15:11) @@ -51,8 +67,16 @@ T7453.hs:21:15: error: z = v where aux = const v + In an equation for ‘cast3’: + cast3 v + = z + where + z :: t + z = v + where + aux = const v • Relevant bindings include aux :: forall b. b -> r (bound at T7453.hs:22:21) z :: t1 (bound at T7453.hs:21:11) v :: r (bound at T7453.hs:19:7) - cast3 :: r -> t (bound at T7453.hs:19:1) + cast3 :: r -> forall t. t (bound at T7453.hs:19:1) diff --git a/testsuite/tests/typecheck/should_fail/T7734.stderr b/testsuite/tests/typecheck/should_fail/T7734.stderr index d4efb614df..53536d1a13 100644 --- a/testsuite/tests/typecheck/should_fail/T7734.stderr +++ b/testsuite/tests/typecheck/should_fail/T7734.stderr @@ -3,6 +3,7 @@ T7734.hs:4:13: error: • Occurs check: cannot construct the infinite type: r2 ~ r2 -> r1 • 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 :: r2 -> r1 (bound at T7734.hs:4:1) f :: (r2 -> r1) -> r -> r1 (bound at T7734.hs:4:1) @@ -11,6 +12,7 @@ T7734.hs:5:13: error: • Occurs check: cannot construct the infinite type: r2 ~ r2 -> r1 • 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 :: r2 -> r1 (bound at T7734.hs:5:5) (&) :: (r2 -> r1) -> r -> r1 (bound at T7734.hs:5:1) diff --git a/testsuite/tests/typecheck/should_fail/T7851.stderr b/testsuite/tests/typecheck/should_fail/T7851.stderr index 64148511e7..14efa7c7c9 100644 --- a/testsuite/tests/typecheck/should_fail/T7851.stderr +++ b/testsuite/tests/typecheck/should_fail/T7851.stderr @@ -1,8 +1,13 @@ -T7851.hs:5:10: - Couldn't match expected type ‘IO a0’ with actual type ‘a1 -> IO ()’ - Probable cause: ‘print’ is applied to too few arguments - In a stmt of a 'do' block: print - In the expression: - do { print; - print "Hello" } +T7851.hs:5:10: error: + • Couldn't match expected type ‘IO a0’ + with actual type ‘a1 -> IO ()’ + • Probable cause: ‘print’ is applied to too few arguments + In a stmt of a 'do' block: print + In the expression: + do { print; + print "Hello" } + In an equation for ‘bar’: + bar + = do { print; + print "Hello" } diff --git a/testsuite/tests/typecheck/should_fail/T8142.stderr b/testsuite/tests/typecheck/should_fail/T8142.stderr index 9ae86c5524..09a2a9677d 100644 --- a/testsuite/tests/typecheck/should_fail/T8142.stderr +++ b/testsuite/tests/typecheck/should_fail/T8142.stderr @@ -1,25 +1,26 @@ T8142.hs:6:18: error: - Couldn't match type ‘Nu g0’ with ‘Nu g’ - NB: ‘Nu’ is a type function, and may not be injective - The type variable ‘g0’ is ambiguous - Expected type: Nu ((,) t) -> Nu g - Actual type: Nu ((,) t0) -> Nu g0 - 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 t (g :: * -> *). Nu ((,) t) -> Nu g - In an equation for ‘tracer’: - tracer - = h - where - h = (\ (_, b) -> ((outI . fmap h) b)) . out + • Couldn't match type ‘Nu g0’ with ‘Nu g’ + NB: ‘Nu’ is a type function, and may not be injective + The type variable ‘g0’ is ambiguous + Expected type: Nu ((,) t) -> Nu g + Actual type: Nu ((,) t0) -> Nu g0 + • 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 t (g :: * -> *). Nu ((,) t) -> Nu g + In an equation for ‘tracer’: + tracer + = h + where + h = (\ (_, b) -> ((outI . fmap h) b)) . out T8142.hs:6:57: error: - Couldn't match type ‘Nu ((,) t)’ with ‘g (Nu ((,) t))’ - Expected type: Nu ((,) t) -> (t, g (Nu ((,) t))) - Actual type: Nu ((,) t) -> (t, Nu ((,) t)) - In the second argument of ‘(.)’, namely ‘out’ - In the expression: (\ (_, b) -> ((outI . fmap h) b)) . out - Relevant bindings include - h :: Nu ((,) t) -> Nu g (bound at T8142.hs:6:18) + • Couldn't match type ‘Nu ((,) t)’ with ‘g (Nu ((,) t))’ + Expected type: Nu ((,) t) -> (t, g (Nu ((,) t))) + Actual type: Nu ((,) t) -> (t, Nu ((,) t)) + • In the second argument of ‘(.)’, namely ‘out’ + In the expression: (\ (_, b) -> ((outI . fmap h) b)) . out + In an equation for ‘h’: h = (\ (_, b) -> ((outI . fmap h) b)) . out + • Relevant bindings include + h :: Nu ((,) t) -> Nu g (bound at T8142.hs:6:18) diff --git a/testsuite/tests/typecheck/should_fail/T8428.stderr b/testsuite/tests/typecheck/should_fail/T8428.stderr index cb4724331c..97cd9f7806 100644 --- a/testsuite/tests/typecheck/should_fail/T8428.stderr +++ b/testsuite/tests/typecheck/should_fail/T8428.stderr @@ -1,10 +1,8 @@ -T8428.hs:11:19: - Couldn't match type ‘(forall s. ST s) a’ with ‘forall s. ST s a’ - Expected type: IdentityT (forall s. ST s) a -> forall s. ST s a - Actual type: IdentityT (forall s. ST s) a -> (forall s. ST s) a - In the second argument of ‘(.)’, namely ‘runIdentityT’ - In the expression: runST . runIdentityT - Relevant bindings include - runIdST :: IdentityT (forall s. ST s) a -> a - (bound at T8428.hs:11:1) +T8428.hs:11:19: error: + • Couldn't match type ‘forall s1. ST s1’ with ‘ST s’ + Expected type: IdentityT (forall s. ST s) a -> forall s. ST s a + Actual type: IdentityT (forall s. ST s) a -> (forall s. ST s) a + • In the second argument of ‘(.)’, namely ‘runIdentityT’ + In the expression: runST . runIdentityT + In an equation for ‘runIdST’: runIdST = runST . runIdentityT diff --git a/testsuite/tests/typecheck/should_fail/T8603.stderr b/testsuite/tests/typecheck/should_fail/T8603.stderr index 5bfd397167..53d4e422cb 100644 --- a/testsuite/tests/typecheck/should_fail/T8603.stderr +++ b/testsuite/tests/typecheck/should_fail/T8603.stderr @@ -5,22 +5,15 @@ T8603.hs:13:10: error: • In the instance declaration for ‘Monad RV’ T8603.hs:29:17: error: - • Couldn't match kind ‘* -> *’ with ‘*’ - When matching the kind of ‘[[a0]]’ + • Couldn't match type ‘RV a0’ with ‘StateT s RV t0’ + Expected type: [Integer] -> StateT s RV t0 + Actual type: (->) ((->) [a0]) (RV a0) • The function ‘lift’ is applied to two arguments, - but its type ‘[] [a0] (StateT s RV t0) - -> (->) [[a0]] (StateT s RV t0)’ + but its type ‘([a0] -> RV a0) -> (->) ((->) [a0]) (RV a0)’ has only one In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] In the expression: do { prize <- lift uniform [1, 2, ....]; return False } - -T8603.hs:29:22: error: - • Couldn't match type ‘RV a0’ with ‘StateT s RV t0’ - Expected type: [] [a0] (StateT s RV t0) - Actual type: [a0] -> RV a0 - • In the first argument of ‘lift’, namely ‘uniform’ - In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] • Relevant bindings include testRVState1 :: RVState s Bool (bound at T8603.hs:28:1) diff --git a/testsuite/tests/typecheck/should_fail/T9109.stderr b/testsuite/tests/typecheck/should_fail/T9109.stderr index defd77572e..f13b0fc310 100644 --- a/testsuite/tests/typecheck/should_fail/T9109.stderr +++ b/testsuite/tests/typecheck/should_fail/T9109.stderr @@ -2,14 +2,13 @@ T9109.hs:8:13: error: • Couldn't match expected type ‘r’ with actual type ‘Bool’ ‘r’ is untouchable - inside the constraints: r1 ~ Bool + inside the constraints: t ~ Bool bound by a pattern with constructor: GBool :: G Bool, in an equation for ‘foo’ at T9109.hs:8:5-9 ‘r’ is a rigid type variable bound by - the inferred type of foo :: G r1 -> r at T9109.hs:8:1 + the inferred type of foo :: G t -> r at T9109.hs:8:1 Possible fix: add a type signature for ‘foo’ • In the expression: True In an equation for ‘foo’: foo GBool = True - • Relevant bindings include - foo :: G r1 -> r (bound at T9109.hs:8:1) + • Relevant bindings include foo :: G t -> r (bound at T9109.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/T9774.stderr b/testsuite/tests/typecheck/should_fail/T9774.stderr index d75942bc59..28b1b58c4c 100644 --- a/testsuite/tests/typecheck/should_fail/T9774.stderr +++ b/testsuite/tests/typecheck/should_fail/T9774.stderr @@ -1,8 +1,8 @@ -T9774.hs:5:29: - Couldn't match type ‘Char’ with ‘[Char]’ - Expected type: String - Actual type: Char - In the second argument of ‘assert’, namely ‘'a'’ - In the first argument of ‘putStrLn’, namely ‘(assert True 'a')’ - In the expression: putStrLn (assert True 'a') +T9774.hs:5:17: error: + • Couldn't match type ‘Char’ with ‘[Char]’ + Expected type: String + Actual type: Char + • In the first argument of ‘putStrLn’, namely ‘(assert True 'a')’ + In the expression: putStrLn (assert True 'a') + In an equation for ‘foo’: foo = putStrLn (assert True 'a') diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr index 1767e8e976..32dac6a133 100644 --- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr +++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr @@ -2,8 +2,7 @@ TcCoercibleFail.hs:11:8: error: • Couldn't match representation of type ‘Int’ with that of ‘()’ arising from a use of ‘coerce’ - • In the expression: coerce - In the expression: coerce $ one :: () + • In the expression: coerce $ one :: () In an equation for ‘foo1’: foo1 = coerce $ one :: () TcCoercibleFail.hs:14:8: error: @@ -12,8 +11,7 @@ TcCoercibleFail.hs:14:8: error: arising from a use of ‘coerce’ NB: We cannot know what roles the parameters to ‘m’ have; we must assume that the role is nominal - • In the expression: coerce - In the expression: coerce $ (return one :: m Int) + • In the expression: coerce $ (return one :: m Int) In an equation for ‘foo2’: foo2 = coerce $ (return one :: m Int) • Relevant bindings include foo2 :: m Age (bound at TcCoercibleFail.hs:14:1) @@ -21,8 +19,7 @@ TcCoercibleFail.hs:14:8: error: TcCoercibleFail.hs:16:8: error: • Couldn't match type ‘Int’ with ‘Age’ arising from a use of ‘coerce’ - • In the expression: coerce - In the expression: coerce $ Map one () :: Map Age () + • In the expression: coerce $ Map one () :: Map Age () In an equation for ‘foo3’: foo3 = coerce $ Map one () :: Map Age () TcCoercibleFail.hs:18:8: error: @@ -31,8 +28,7 @@ TcCoercibleFail.hs:18:8: error: arising from a use of ‘coerce’ The data constructor ‘Data.Ord.Down’ of newtype ‘Down’ is not in scope - • In the expression: coerce - In the expression: coerce $ one :: Down Int + • In the expression: coerce $ one :: Down Int In an equation for ‘foo4’: foo4 = coerce $ one :: Down Int TcCoercibleFail.hs:21:8: error: diff --git a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.stderr b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.stderr index e41ec7443d..9b85edb110 100644 --- a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.stderr +++ b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.stderr @@ -1,6 +1,7 @@ -TcStaticPointersFail01.hs:8:13: - Couldn't match expected type ‘Int’ with actual type ‘Int -> Int’ - Probable cause: ‘g’ is applied to too few arguments - In the body of a static form: g - In the expression: static g +TcStaticPointersFail01.hs:8:13: error: + • Couldn't match expected type ‘Int’ with actual type ‘Int -> Int’ + • Probable cause: ‘g’ is applied to too few arguments + In the body of a static form: g + In the expression: static g + In an equation for ‘f0’: f0 = static g diff --git a/testsuite/tests/typecheck/should_fail/VtaFail.hs b/testsuite/tests/typecheck/should_fail/VtaFail.hs new file mode 100644 index 0000000000..250f9e273e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/VtaFail.hs @@ -0,0 +1,57 @@ +{-# LANGUAGE TypeApplications, RankNTypes, PolyKinds #-} + +module VtaFail1 where + +pairup_nosig x y = (x, y) + +answer_nosig = pairup_nosig @Int @Bool 5 True + +addOne :: Num a => a -> a +addOne x = x + 1 + +answer_constraint_fail = addOne @Bool 5 + +answer_lambda = (\x -> x) @Int 12 + +pair :: forall a. a -> forall b. b -> (a, b) +pair = (,) + +a = pair 3 @Int @Bool True + +data First (a :: * -> *) = F + +first :: First a -> Int +first _ = 0 + +fInt = first @Int F -- should fail + +data Proxy (a :: k) = P -- This expands to P (kind variable) (type variable) + +foo :: Proxy a -> Int +foo _ = 0 + +baz = foo @Bool (P :: Proxy Int) -- should fail + +data Three (a :: * -> k -> *) = T + +too :: Three a -> Int +too _ = 3 + +threeBad = too @Maybe T +threeWorse = too @( -> ) (T :: Three Either) + +plus :: Int -> Int -> Int +plus = (+) + +b = plus @Int 5 7 +c = plus @Rational 5 10 +d = (+) @Int @Int @Int 12 14 + + +e = show @Int @Float (read "5") +f = show (read @Int @Bool @Float "3") + +silly :: a -> Bool +silly _ = False + +g = silly @Maybe -- should fail diff --git a/testsuite/tests/typecheck/should_fail/VtaFail.stderr b/testsuite/tests/typecheck/should_fail/VtaFail.stderr new file mode 100644 index 0000000000..313d174b74 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/VtaFail.stderr @@ -0,0 +1,94 @@ + +VtaFail.hs:7:16: error: + • Cannot not apply expression of type ‘t1 -> t0 -> (t1, t0)’ + to a visible type argument ‘Int’ + • In the expression: pairup_nosig @Int @Bool 5 True + In an equation for ‘answer_nosig’: + answer_nosig = pairup_nosig @Int @Bool 5 True + +VtaFail.hs:12:26: error: + • No instance for (Num Bool) arising from a use of ‘addOne’ + • In the expression: addOne @Bool 5 + In an equation for ‘answer_constraint_fail’: + answer_constraint_fail = addOne @Bool 5 + +VtaFail.hs:14:17: error: + • Cannot not apply expression of type ‘r0 -> r0’ + to a visible type argument ‘Int’ + • In the expression: (\ x -> x) @Int 12 + In an equation for ‘answer_lambda’: + answer_lambda = (\ x -> x) @Int 12 + +VtaFail.hs:19:5: error: + • Cannot not apply expression of type ‘Int -> (a0, Int)’ + to a visible type argument ‘Bool’ + • In the expression: pair 3 @Int @Bool True + In an equation for ‘a’: a = pair 3 @Int @Bool True + +VtaFail.hs:26:15: error: + • Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’ + • In the type ‘Int’ + In the expression: first @Int F + In an equation for ‘fInt’: fInt = first @Int F + +VtaFail.hs:33:18: error: + • Couldn't match type ‘Int’ with ‘Bool’ + Expected type: Proxy Bool + Actual type: Proxy Int + • In the second argument of ‘foo’, namely ‘(P :: Proxy Int)’ + In the expression: foo @Bool (P :: Proxy Int) + In an equation for ‘baz’: baz = foo @Bool (P :: Proxy Int) + +VtaFail.hs:40:17: error: + • Expected kind ‘* -> k0 -> *’, but ‘Maybe’ has kind ‘* -> *’ + • In the type ‘Maybe’ + In the expression: too @Maybe T + In an equation for ‘threeBad’: threeBad = too @Maybe T + +VtaFail.hs:41:27: error: + • Couldn't match type ‘Either’ with ‘(->)’ + Expected type: Three (->) + Actual type: Three Either + • In the second argument of ‘too’, namely ‘(T :: Three Either)’ + In the expression: too @(->) (T :: Three Either) + In an equation for ‘threeWorse’: + threeWorse = too @(->) (T :: Three Either) + +VtaFail.hs:46:5: error: + • Cannot not apply expression of type ‘Int -> Int -> Int’ + to a visible type argument ‘Int’ + • In the expression: plus @Int 5 7 + In an equation for ‘b’: b = plus @Int 5 7 + +VtaFail.hs:47:5: error: + • Cannot not apply expression of type ‘Int -> Int -> Int’ + to a visible type argument ‘Rational’ + • In the expression: plus @Rational 5 10 + In an equation for ‘c’: c = plus @Rational 5 10 + +VtaFail.hs:48:5: error: + • Cannot not apply expression of type ‘Int -> Int -> Int’ + to a visible type argument ‘Int’ + • In the expression: (+) @Int @Int @Int 12 14 + In an equation for ‘d’: d = (+) @Int @Int @Int 12 14 + +VtaFail.hs:51:5: error: + • Cannot not apply expression of type ‘Int -> String’ + to a visible type argument ‘Float’ + • In the expression: show @Int @Float (read "5") + In an equation for ‘e’: e = show @Int @Float (read "5") + +VtaFail.hs:52:11: error: + • Cannot not apply expression of type ‘String -> Int’ + to a visible type argument ‘Bool’ + • In the first argument of ‘show’, namely + ‘(read @Int @Bool @Float "3")’ + In the expression: show (read @Int @Bool @Float "3") + In an equation for ‘f’: f = show (read @Int @Bool @Float "3") + +VtaFail.hs:57:12: error: + • Expecting one more argument to ‘Maybe’ + Expected a type, but ‘Maybe’ has kind ‘* -> *’ + • In the type ‘Maybe’ + In the expression: silly @Maybe + In an equation for ‘g’: g = silly @Maybe diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 8d8d4306e7..aa43cce226 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -147,7 +147,7 @@ test('tcfail160', normal, compile_fail, ['']) test('tcfail161', normal, compile_fail, ['']) test('tcfail162', normal, compile_fail, ['']) test('tcfail164', normal, compile_fail, ['']) -test('tcfail165', normal, compile_fail, ['']) +test('tcfail165', normal, compile, ['']) test('tcfail166', normal, compile_fail, ['']) test('tcfail167', normal, compile_fail, ['']) test('tcfail168', normal, compile_fail, ['']) @@ -379,6 +379,7 @@ test('T10351', normal, compile_fail, ['']) test('T10534', extra_clean(['T10534a.hi', 'T10534a.o']), multimod_compile_fail, ['T10534', '-v0']) test('T10495', normal, compile_fail, ['']) +test('VtaFail', normal, compile_fail, ['']) test('ExpandSynsFail1', normal, compile_fail, ['-fprint-expanded-synonyms']) test('ExpandSynsFail2', normal, compile_fail, ['-fprint-expanded-synonyms']) diff --git a/testsuite/tests/typecheck/should_fail/mc19.stderr b/testsuite/tests/typecheck/should_fail/mc19.stderr index 8cdd4f456b..5f004dc4a8 100644 --- a/testsuite/tests/typecheck/should_fail/mc19.stderr +++ b/testsuite/tests/typecheck/should_fail/mc19.stderr @@ -1,11 +1,12 @@ -
-mc19.hs:10:31: error:
- Couldn't match type ‘a’ with ‘[a]’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [a]
- at mc19.hs:10:10
- Expected type: [a] -> [a]
- Actual type: [a] -> [[a]]
- In the expression: inits
- In a stmt of a monad comprehension: then inits
+ +mc19.hs:10:31: error: + • Couldn't match type ‘a’ with ‘[a]’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. [a] -> [a] + at mc19.hs:10:10 + Expected type: [a] -> [a] + Actual type: [a] -> [[a]] + • In the expression: inits + In a stmt of a monad comprehension: then inits + In the expression: [x | x <- [3, 2, 1], then inits] diff --git a/testsuite/tests/typecheck/should_fail/mc21.stderr b/testsuite/tests/typecheck/should_fail/mc21.stderr index 3017d2221c..74a13b14bc 100644 --- a/testsuite/tests/typecheck/should_fail/mc21.stderr +++ b/testsuite/tests/typecheck/should_fail/mc21.stderr @@ -1,11 +1,13 @@ -
-mc21.hs:12:26: error:
- Couldn't match type ‘a’ with ‘[a]’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [[a]]
- at mc21.hs:11:9
- Expected type: [a] -> [[a]]
- Actual type: [[a]] -> [[a]]
- In the expression: take 5
- In a stmt of a monad comprehension: then group using take 5
+ +mc21.hs:12:26: error: + • Couldn't match type ‘a’ with ‘[a]’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. [a] -> [[a]] + at mc21.hs:11:9 + Expected type: [a] -> [[a]] + Actual type: [[a]] -> [[a]] + • In the expression: take 5 + In a stmt of a monad comprehension: then group using take 5 + In the expression: + [GHC.List.length x | x <- [Gnorf, Brain], then group using take 5] diff --git a/testsuite/tests/typecheck/should_fail/mc22.stderr b/testsuite/tests/typecheck/should_fail/mc22.stderr index 1c6dc386dd..5e369d7ffe 100644 --- a/testsuite/tests/typecheck/should_fail/mc22.stderr +++ b/testsuite/tests/typecheck/should_fail/mc22.stderr @@ -1,24 +1,27 @@ -
-mc22.hs:9:9: error:
- No instance for (Functor t) arising from a use of ‘fmap’
- Possible fix:
- add (Functor t) to the context of
- a type expected by the context:
- (a -> b) -> t a -> t b
- or the inferred type of foo :: [t [Char]]
- In the expression: fmap
- In a stmt of a monad comprehension: then group using take 5
- In the expression:
- [x + 1 | x <- ["Hello", "World"], then group using take 5]
-
-mc22.hs:10:26: error:
- Couldn't match type ‘a’ with ‘t a’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [t a]
- at mc22.hs:9:9
- Expected type: [a] -> [t a]
- Actual type: [t a] -> [t a]
- In the expression: take 5
- In a stmt of a monad comprehension: then group using take 5
- Relevant bindings include foo :: [t [Char]] (bound at mc22.hs:8:1)
+ +mc22.hs:9:9: error: + • No instance for (Functor t) arising from a use of ‘fmap’ + Possible fix: + add (Functor t) to the context of + a type expected by the context: + (a -> b) -> t a -> t b + or the inferred type of foo :: [t [Char]] + • In the expression: fmap + In a stmt of a monad comprehension: then group using take 5 + In the expression: + [x + 1 | x <- ["Hello", "World"], then group using take 5] + +mc22.hs:10:26: error: + • Couldn't match type ‘a’ with ‘t a’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. [a] -> [t a] + at mc22.hs:9:9 + Expected type: [a] -> [t a] + Actual type: [t a] -> [t a] + • In the expression: take 5 + In a stmt of a monad comprehension: then group using take 5 + In the expression: + [x + 1 | x <- ["Hello", "World"], then group using take 5] + • Relevant bindings include + foo :: [t [Char]] (bound at mc22.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/mc23.stderr b/testsuite/tests/typecheck/should_fail/mc23.stderr index 945d1a6db8..2f3ae27a98 100644 --- a/testsuite/tests/typecheck/should_fail/mc23.stderr +++ b/testsuite/tests/typecheck/should_fail/mc23.stderr @@ -1,9 +1,10 @@ -mc23.hs:9:29: - Couldn't match type ‘[a0]’ with ‘[a] -> m a’ - Expected type: (a -> b) -> [a] -> m a - Actual type: [a0] -> [a0] - Possible cause: ‘take’ is applied to too many arguments - In the expression: take 5 - In a stmt of a monad comprehension: then take 5 by x - Relevant bindings include z :: m b (bound at mc23.hs:9:1) +mc23.hs:9:29: error: + • Couldn't match type ‘[a0]’ with ‘[a] -> m a’ + Expected type: (a -> b) -> [a] -> m a + Actual type: [a0] -> [a0] + • Possible cause: ‘take’ is applied to too many arguments + In the expression: take 5 + In a stmt of a monad comprehension: then take 5 by x + In the expression: [x | x <- [1 .. 10], then take 5 by x] + • Relevant bindings include z :: m b (bound at mc23.hs:9:1) diff --git a/testsuite/tests/typecheck/should_fail/mc24.stderr b/testsuite/tests/typecheck/should_fail/mc24.stderr index b14fd81162..7f016283b1 100644 --- a/testsuite/tests/typecheck/should_fail/mc24.stderr +++ b/testsuite/tests/typecheck/should_fail/mc24.stderr @@ -1,9 +1,11 @@ -mc24.hs:10:31: - Couldn't match type ‘[a0]’ with ‘[a] -> m [a]’ - Expected type: (a -> Integer) -> [a] -> m [a] - Actual type: [a0] -> [a0] - Possible cause: ‘take’ is applied to too many arguments - In the expression: take 2 - In a stmt of a monad comprehension: then group by x using take 2 - Relevant bindings include foo :: m Int (bound at mc24.hs:8:1) +mc24.hs:10:31: error: + • Couldn't match type ‘[a0]’ with ‘[a] -> m [a]’ + Expected type: (a -> Integer) -> [a] -> m [a] + Actual type: [a0] -> [a0] + • Possible cause: ‘take’ is applied to too many arguments + In the expression: take 2 + In a stmt of a monad comprehension: then group by x using take 2 + In the expression: + [GHC.List.length x | x <- [1 .. 10], then group by x using take 2] + • Relevant bindings include foo :: m Int (bound at mc24.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/mc25.stderr b/testsuite/tests/typecheck/should_fail/mc25.stderr index 0989dbcf70..406f89e719 100644 --- a/testsuite/tests/typecheck/should_fail/mc25.stderr +++ b/testsuite/tests/typecheck/should_fail/mc25.stderr @@ -1,18 +1,20 @@ mc25.hs:9:10: error: - No instance for (Functor t1) arising from a use of ‘fmap’ - Possible fix: - add (Functor t1) to the context of - a type expected by the context: (a -> b) -> t1 a -> t1 b - or the inferred type of z :: [t1 t] - In the expression: fmap - 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] + • No instance for (Functor t1) arising from a use of ‘fmap’ + Possible fix: + add (Functor t1) to the context of + a type expected by the context: + (a -> b) -> t1 a -> t1 b + or the inferred type of z :: [t1 t] + • In the expression: fmap + 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] 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] - In the expression: take - In a stmt of a monad comprehension: then group by x using take - Relevant bindings include z :: [t1 t] (bound at mc25.hs:9:1) + • Couldn't match type ‘a -> t’ with ‘Int’ + Expected type: (a -> t) -> [a] -> [t1 a] + Actual type: Int -> [t1 a] -> [t1 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) diff --git a/testsuite/tests/typecheck/should_fail/tcfail001.stderr b/testsuite/tests/typecheck/should_fail/tcfail001.stderr index b30d995455..0b0a799c04 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail001.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail001.stderr @@ -1,7 +1,8 @@ -tcfail001.hs:9:2: - Couldn't match expected type ‘[t0] -> [t1]’ with actual type ‘[a]’ - The equation(s) for ‘op’ have one argument, - but its type ‘[a]’ has none - In the instance declaration for ‘A [a]’ - Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) +tcfail001.hs:9:2: error: + • Couldn't match expected type ‘[a]’ + with actual type ‘[t0] -> [t1]’ + • The equation(s) for ‘op’ have one argument, + but its type ‘[a]’ has none + In the instance declaration for ‘A [a]’ + • Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) diff --git a/testsuite/tests/typecheck/should_fail/tcfail002.stderr b/testsuite/tests/typecheck/should_fail/tcfail002.stderr index 285b6bf577..6755636682 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail002.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail002.stderr @@ -1,8 +1,8 @@ tcfail002.hs:4:7: error: - • Occurs check: cannot construct the infinite type: r ~ [r] + • Occurs check: cannot construct the infinite type: t ~ [t] • In the expression: z In an equation for ‘c’: c z = z • Relevant bindings include - z :: [r] (bound at tcfail002.hs:4:3) - c :: [r] -> r (bound at tcfail002.hs:3:1) + z :: [t] (bound at tcfail002.hs:4:3) + c :: [t] -> t (bound at tcfail002.hs:3:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail004.stderr b/testsuite/tests/typecheck/should_fail/tcfail004.stderr index 2294a6166f..c575129cf5 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail004.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail004.stderr @@ -1,9 +1,9 @@ tcfail004.hs:3:9: error: - • Couldn't match expected type ‘(r, r1)’ + • Couldn't match expected type ‘(t, t1)’ with actual type ‘(Integer, Integer, Integer)’ • In the expression: (1, 2, 3) In a pattern binding: (f, g) = (1, 2, 3) • Relevant bindings include - f :: r (bound at tcfail004.hs:3:2) - g :: r1 (bound at tcfail004.hs:3:4) + f :: t (bound at tcfail004.hs:3:2) + g :: t1 (bound at tcfail004.hs:3:4) diff --git a/testsuite/tests/typecheck/should_fail/tcfail005.stderr b/testsuite/tests/typecheck/should_fail/tcfail005.stderr index 4c585af3da..77437cf583 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail005.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail005.stderr @@ -1,9 +1,9 @@ tcfail005.hs:3:9: error: - • Couldn't match expected type ‘[r]’ + • Couldn't match expected type ‘[t]’ with actual type ‘(Integer, Char)’ • In the expression: (1, 'a') In a pattern binding: (h : i) = (1, 'a') • Relevant bindings include - h :: r (bound at tcfail005.hs:3:2) - i :: [r] (bound at tcfail005.hs:3:4) + h :: t (bound at tcfail005.hs:3:2) + i :: [t] (bound at tcfail005.hs:3:4) diff --git a/testsuite/tests/typecheck/should_fail/tcfail007.stderr b/testsuite/tests/typecheck/should_fail/tcfail007.stderr index 5ea9792256..4c1652fe50 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail007.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail007.stderr @@ -1,8 +1,8 @@ -tcfail007.hs:3:15: - No instance for (Num Bool) arising from a use of ‘+’ - In the expression: x + 1 - In an equation for ‘n’: - n x - | True = x + 1 - | False = True +tcfail007.hs:3:14: error: + • No instance for (Num Bool) arising from a use of ‘+’ + • In the expression: x + 1 + In an equation for ‘n’: + n x + | True = x + 1 + | False = True diff --git a/testsuite/tests/typecheck/should_fail/tcfail010.stderr b/testsuite/tests/typecheck/should_fail/tcfail010.stderr index 92ee3d8f8e..c22a05e777 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail010.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail010.stderr @@ -1,6 +1,6 @@ -tcfail010.hs:3:17: - No instance for (Num [r0]) arising from a use of ‘+’ - In the expression: z + 2 - In the expression: \ (y : z) -> z + 2 - In an equation for ‘q’: q = \ (y : z) -> z + 2 +tcfail010.hs:3:16: error: + • No instance for (Num [t0]) arising from a use of ‘+’ + • In the expression: z + 2 + In the expression: \ (y : z) -> z + 2 + In an equation for ‘q’: q = \ (y : z) -> z + 2 diff --git a/testsuite/tests/typecheck/should_fail/tcfail013.stderr b/testsuite/tests/typecheck/should_fail/tcfail013.stderr index 332f10e729..ff7702213c 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail013.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail013.stderr @@ -1,7 +1,7 @@ tcfail013.hs:4:3: error: - • Couldn't match expected type ‘[r]’ with actual type ‘Bool’ + • Couldn't match expected type ‘[t1]’ with actual type ‘Bool’ • In the pattern: True In an equation for ‘f’: f True = 2 • Relevant bindings include - f :: [r] -> a (bound at tcfail013.hs:3:1) + f :: [t1] -> t (bound at tcfail013.hs:3:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail014.stderr b/testsuite/tests/typecheck/should_fail/tcfail014.stderr index 92307b3830..6b88e835ed 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail014.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail014.stderr @@ -3,6 +3,7 @@ tcfail014.hs:5:33: error: • Occurs check: cannot construct the infinite type: r8 ~ r8 -> r7 • In the first argument of ‘z’, namely ‘z’ In the expression: z z + In an equation for ‘h’: h z = z z • Relevant bindings include z :: r8 -> r7 (bound at tcfail014.hs:5:27) h :: (r8 -> r7) -> r7 (bound at tcfail014.hs:5:25) diff --git a/testsuite/tests/typecheck/should_fail/tcfail016.stderr b/testsuite/tests/typecheck/should_fail/tcfail016.stderr index 59c8fa4e3d..cb1fa945e7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail016.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail016.stderr @@ -1,22 +1,24 @@ -tcfail016.hs:9:20: - Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ - Expected type: Expr t - Actual type: AnnExpr t - In the first argument of ‘g’, namely ‘e1’ - In the first argument of ‘(++)’, namely ‘(g e1)’ - Relevant bindings include - e2 :: AnnExpr t (bound at tcfail016.hs:9:11) - e1 :: AnnExpr t (bound at tcfail016.hs:9:8) - g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) +tcfail016.hs:9:20: error: + • Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ + Expected type: Expr t + Actual type: AnnExpr t + • In the first argument of ‘g’, namely ‘e1’ + In the first argument of ‘(++)’, namely ‘(g e1)’ + In the expression: (g e1) ++ (g e2) + • Relevant bindings include + e2 :: AnnExpr t (bound at tcfail016.hs:9:11) + e1 :: AnnExpr t (bound at tcfail016.hs:9:8) + g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) -tcfail016.hs:9:28: - Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ - Expected type: Expr t - Actual type: AnnExpr t - In the first argument of ‘g’, namely ‘e2’ - In the second argument of ‘(++)’, namely ‘(g e2)’ - Relevant bindings include - e2 :: AnnExpr t (bound at tcfail016.hs:9:11) - e1 :: AnnExpr t (bound at tcfail016.hs:9:8) - g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) +tcfail016.hs:9:28: error: + • Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ + Expected type: Expr t + Actual type: AnnExpr t + • In the first argument of ‘g’, namely ‘e2’ + In the second argument of ‘(++)’, namely ‘(g e2)’ + In the expression: (g e1) ++ (g e2) + • Relevant bindings include + e2 :: AnnExpr t (bound at tcfail016.hs:9:11) + e1 :: AnnExpr t (bound at tcfail016.hs:9:8) + g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail018.stderr b/testsuite/tests/typecheck/should_fail/tcfail018.stderr index 88c08a8a8b..57060a87db 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail018.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail018.stderr @@ -1,5 +1,5 @@ -tcfail018.hs:5:10: - No instance for (Num [r0]) arising from the literal ‘1’ - In the expression: 1 - In a pattern binding: (a : []) = 1 +tcfail018.hs:5:10: error: + • No instance for (Num [t0]) arising from the literal ‘1’ + • In the expression: 1 + In a pattern binding: (a : []) = 1 diff --git a/testsuite/tests/typecheck/should_fail/tcfail029.stderr b/testsuite/tests/typecheck/should_fail/tcfail029.stderr index 5b794458e8..c31c5869b9 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail029.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail029.stderr @@ -1,5 +1,5 @@ -tcfail029.hs:6:9: - No instance for (Ord Foo) arising from a use of ‘>’ - In the expression: x > Bar - In an equation for ‘f’: f x = x > Bar +tcfail029.hs:6:7: error: + • No instance for (Ord Foo) arising from a use of ‘>’ + • In the expression: x > Bar + In an equation for ‘f’: f x = x > Bar diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.stderr b/testsuite/tests/typecheck/should_fail/tcfail032.stderr index 05d33a5e05..79ec408274 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail032.stderr @@ -10,4 +10,4 @@ tcfail032.hs:14:8: error: In an equation for ‘f’: f x = (x :: (Eq a) => a -> Int) • Relevant bindings include x :: r (bound at tcfail032.hs:14:3) - f :: r -> a -> Int (bound at tcfail032.hs:14:1) + f :: r -> forall a. Eq a => a -> Int (bound at tcfail032.hs:14:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail033.stderr b/testsuite/tests/typecheck/should_fail/tcfail033.stderr index fd2887de60..94e998f05f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail033.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail033.stderr @@ -1,9 +1,10 @@ -tcfail033.hs:4:12: - Occurs check: cannot construct the infinite type: t ~ (t, t1) - In the expression: x - In the expression: [x | (x, y) <- buglet] - Relevant bindings include - y :: t1 (bound at tcfail033.hs:4:19) - x :: t (bound at tcfail033.hs:4:17) - buglet :: [(t, t1)] (bound at tcfail033.hs:4:1) +tcfail033.hs:4:12: error: + • Occurs check: cannot construct the infinite type: t ~ (t, t1) + • In the expression: x + In the expression: [x | (x, y) <- buglet] + In an equation for ‘buglet’: buglet = [x | (x, y) <- buglet] + • Relevant bindings include + y :: t1 (bound at tcfail033.hs:4:19) + x :: t (bound at tcfail033.hs:4:17) + buglet :: [(t, t1)] (bound at tcfail033.hs:4:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail034.stderr b/testsuite/tests/typecheck/should_fail/tcfail034.stderr index 1a8d6d7802..baf68da924 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail034.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail034.stderr @@ -1,14 +1,14 @@ -
-tcfail034.hs:17:13: 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
- 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
- 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
+ +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 + 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 + • 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/tcfail065.stderr b/testsuite/tests/typecheck/should_fail/tcfail065.stderr index 65befaf29e..369b0807d7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail065.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail065.stderr @@ -1,14 +1,17 @@ -tcfail065.hs:29:20: error: - • Couldn't match expected type ‘x’ with actual type ‘x1’ +tcfail065.hs:29:18: error: + • Couldn't match type ‘x1’ with ‘x’ ‘x1’ is a rigid type variable bound by the type signature for: setX :: forall x1. x1 -> X x -> X x at tcfail065.hs:29:3 ‘x’ is a rigid type variable bound by the instance declaration at tcfail065.hs:28:10 - • In the first argument of ‘X’, namely ‘x’ - In the expression: X x + Expected type: X x + Actual type: X x1 + • In the expression: X x + In an equation for ‘setX’: setX x (X _) = X x + In the instance declaration for ‘HasX (X x)’ • Relevant bindings include x :: x1 (bound at tcfail065.hs:29:8) setX :: x1 -> X x -> X x (bound at tcfail065.hs:29:3) diff --git a/testsuite/tests/typecheck/should_fail/tcfail068.stderr b/testsuite/tests/typecheck/should_fail/tcfail068.stderr index 5ca47f52ed..eb42f9a33b 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail068.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail068.stderr @@ -16,11 +16,13 @@ tcfail068.hs:14:9: error: • In the first argument of ‘runST’, namely ‘(newSTArray ((1, 1), n) x)’ In the expression: runST (newSTArray ((1, 1), n) x) + In an equation for ‘itgen’: + itgen n x = runST (newSTArray ((1, 1), n) x) • Relevant bindings include itgen :: (Int, Int) -> a -> IndTree s a (bound at tcfail068.hs:12:1) -tcfail068.hs:19:21: error: +tcfail068.hs:19:9: error: • Couldn't match type ‘s’ with ‘s1’ ‘s’ is a rigid type variable bound by the type signature for: @@ -32,10 +34,20 @@ tcfail068.hs:19:21: error: a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) at tcfail068.hs:18:9 - Expected type: STArray s1 (Int, Int) a - Actual type: IndTree s a - • In the first argument of ‘readSTArray’, namely ‘arr’ - In the first argument of ‘(>>=)’, namely ‘readSTArray arr i’ + Expected type: GHC.ST.ST s1 (IndTree s a) + Actual type: GHC.ST.ST s (IndTree s a) + • In the first argument of ‘runST’, namely + ‘(readSTArray arr i + >>= \ val -> writeSTArray arr i (f val) >> return arr)’ + In the expression: + runST + (readSTArray arr i + >>= \ val -> writeSTArray arr i (f val) >> return arr) + In an equation for ‘itiap’: + itiap i f arr + = runST + (readSTArray arr i + >>= \ val -> writeSTArray arr i (f val) >> return arr) • Relevant bindings include arr :: IndTree s a (bound at tcfail068.hs:17:11) itiap :: (Int, Int) -> (a -> a) -> IndTree s a -> IndTree s a @@ -57,6 +69,17 @@ tcfail068.hs:24:36: error: Actual type: GHC.ST.ST s (IndTree s a) • In the first argument of ‘runST’, namely ‘(itrap' i k)’ In the expression: runST (itrap' i k) + In an equation for ‘itrap’: + itrap ((i, k), (j, l)) f arr + = runST (itrap' i k) + where + itrap' i k + = if k > l then return arr else (itrapsnd i k >> itrap' i (k + 1)) + itrapsnd i k + = if i > j then + return arr + else + (readSTArray arr (i, k) >>= \ val -> ...) • Relevant bindings include itrap' :: Int -> Int -> GHC.ST.ST s (IndTree s a) (bound at tcfail068.hs:26:9) @@ -89,6 +112,20 @@ tcfail068.hs:36:46: error: Actual type: GHC.ST.ST s (c, IndTree s b) • In the first argument of ‘runST’, namely ‘(itrapstate' i k s)’ In the expression: runST (itrapstate' i k s) + In an equation for ‘itrapstate’: + itrapstate ((i, k), (j, l)) f c d s arr + = runST (itrapstate' i k s) + where + itrapstate' i k s + = if k > l then + return (s, arr) + else + (itrapstatesnd i k s >>= \ (s, arr) -> ...) + itrapstatesnd i k s + = if i > j then + return (s, arr) + else + (readSTArray arr (i, k) >>= \ val -> ...) • Relevant bindings include itrapstate' :: Int -> Int -> c -> GHC.ST.ST s (c, IndTree s b) (bound at tcfail068.hs:38:9) diff --git a/testsuite/tests/typecheck/should_fail/tcfail076.stderr b/testsuite/tests/typecheck/should_fail/tcfail076.stderr index 8283ef0458..242c62235e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail076.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail076.stderr @@ -13,6 +13,7 @@ tcfail076.hs:18:82: error: Actual type: m res • In the expression: cont a In the first argument of ‘KContT’, namely ‘(\ cont' -> cont a)’ + In the expression: KContT (\ cont' -> cont a) • Relevant bindings include cont' :: b -> m res1 (bound at tcfail076.hs:18:73) cont :: a -> m res (bound at tcfail076.hs:18:37) diff --git a/testsuite/tests/typecheck/should_fail/tcfail099.stderr b/testsuite/tests/typecheck/should_fail/tcfail099.stderr index 687fafb6da..3ba8165766 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail099.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail099.stderr @@ -8,6 +8,7 @@ tcfail099.hs:9:20: error: at tcfail099.hs:9:7-9 • In the first argument of ‘f’, namely ‘arg’ In the expression: f arg + In an equation for ‘call’: call (C f) arg = f arg • Relevant bindings include arg :: r (bound at tcfail099.hs:9:12) f :: a -> Int (bound at tcfail099.hs:9:9) diff --git a/testsuite/tests/typecheck/should_fail/tcfail103.stderr b/testsuite/tests/typecheck/should_fail/tcfail103.stderr index 627ef1158c..2d76dc588a 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail103.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail103.stderr @@ -1,19 +1,24 @@ -
-tcfail103.hs:15:23: error:
- Couldn't match type ‘t’ with ‘s’
- ‘t’ is a rigid type variable bound by
- the type signature for:
- f :: forall t. ST t Int
- at tcfail103.hs:10:5
- ‘s’ is a rigid type variable bound by
- the type signature for:
- g :: forall s. ST s Int
- at tcfail103.hs:13:14
- Expected type: STRef s Int
- Actual type: STRef t Int
- In the first argument of ‘readSTRef’, namely ‘v’
- In the expression: readSTRef v
- Relevant bindings include
- g :: ST s Int (bound at tcfail103.hs:15:9)
- v :: STRef t Int (bound at tcfail103.hs:12:5)
- f :: ST t Int (bound at tcfail103.hs:11:1)
+ +tcfail103.hs:15:13: error: + • Couldn't match type ‘t’ with ‘s’ + ‘t’ is a rigid type variable bound by + the type signature for: + f :: forall t. ST t Int + at tcfail103.hs:10:5 + ‘s’ is a rigid type variable bound by + the type signature for: + g :: forall s. ST s Int + at tcfail103.hs:13:14 + Expected type: ST s Int + Actual type: ST t Int + • In the expression: readSTRef v + In an equation for ‘g’: g = readSTRef v + In the expression: + do { v <- newSTRef 5; + let g :: ST s Int + g = readSTRef v; + g } + • Relevant bindings include + g :: ST s Int (bound at tcfail103.hs:15:9) + v :: STRef t Int (bound at tcfail103.hs:12:5) + f :: ST t Int (bound at tcfail103.hs:11:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail104.stderr b/testsuite/tests/typecheck/should_fail/tcfail104.stderr index cb14d9af26..b6c21e5e82 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail104.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail104.stderr @@ -1,12 +1,16 @@ -tcfail104.hs:16:19: - Couldn't match expected type ‘Char -> Char’ - with actual type ‘forall a. a -> a’ - In the expression: x - In the expression: (\ x -> x) +tcfail104.hs:14:15: error: + • Couldn't match expected type ‘forall a. a -> a’ + with actual type ‘Char -> Char’ + • When checking that the pattern signature: forall a. a -> a + fits the type of its context: Char -> Char + In the pattern: x :: forall a. a -> a + In the expression: (\ (x :: forall a. a -> a) -> x) -tcfail104.hs:22:39: - Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a0 -> a0’ - In the expression: x - In the expression: (\ (x :: forall a. a -> a) -> x) +tcfail104.hs:22:15: error: + • Couldn't match expected type ‘forall a. a -> a’ + with actual type ‘Char -> Char’ + • When checking that the pattern signature: forall a. a -> a + fits the type of its context: Char -> Char + In the pattern: x :: forall a. a -> a + In the expression: (\ (x :: forall a. a -> a) -> x) diff --git a/testsuite/tests/typecheck/should_fail/tcfail131.stderr b/testsuite/tests/typecheck/should_fail/tcfail131.stderr index 03bdc72eff..2ae70a0928 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail131.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail131.stderr @@ -1,11 +1,12 @@ -tcfail131.hs:7:9: error: - • Couldn't match expected type ‘b’ with actual type ‘Integer’ +tcfail131.hs:7:11: error: + • Couldn't match expected type ‘Integer’ with actual type ‘b’ ‘b’ is a rigid type variable bound by the type signature for: g :: forall b. Num b => b -> b at tcfail131.hs:6:8 - • In the expression: f x x + • In the first argument of ‘f’, namely ‘x’ + In the expression: f x x In an equation for ‘g’: g x = f x x • Relevant bindings include x :: b (bound at tcfail131.hs:7:5) diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr index ac85d0be71..a178f02801 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr @@ -14,8 +14,7 @@ tcfail133.hs:68:7: error: ...plus 25 others ...plus three instance involving out-of-scope typess (use -fprint-potential-instances to see them all) - • In the expression: show - In the expression: show $ add (One :@ Zero) (One :@ One) + • In the expression: show $ add (One :@ Zero) (One :@ One) In an equation for ‘foo’: foo = show $ add (One :@ Zero) (One :@ One) diff --git a/testsuite/tests/typecheck/should_fail/tcfail140.stderr b/testsuite/tests/typecheck/should_fail/tcfail140.stderr index 41268ec6df..b3bf602200 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail140.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail140.stderr @@ -19,14 +19,14 @@ tcfail140.hs:12:10: error: rot :: r -> t (bound at tcfail140.hs:12:1) tcfail140.hs:14:15: error: - • Couldn't match expected type ‘a -> b’ with actual type ‘Int’ + • Couldn't match expected type ‘t -> b’ with actual type ‘Int’ • The operator ‘f’ takes two arguments, but its type ‘Int -> Int’ has only one In the first argument of ‘map’, namely ‘(3 `f`)’ In the expression: map (3 `f`) xs • Relevant bindings include - xs :: [a] (bound at tcfail140.hs:14:5) - bot :: [a] -> [b] (bound at tcfail140.hs:14:1) + xs :: [t] (bound at tcfail140.hs:14:5) + bot :: [t] -> [b] (bound at tcfail140.hs:14:1) tcfail140.hs:16:8: error: • The constructor ‘Just’ should have 1 argument, but has been given none @@ -35,6 +35,6 @@ tcfail140.hs:16:8: error: In the expression: ((\ Just x -> x) :: Maybe a -> a) (Just 1) tcfail140.hs:19:1: error: - • Couldn't match expected type ‘t0 -> Bool’ with actual type ‘Int’ + • Couldn't match expected type ‘Int’ with actual type ‘t0 -> Bool’ • The equation(s) for ‘g’ have two arguments, but its type ‘Int -> Int’ has only one diff --git a/testsuite/tests/typecheck/should_fail/tcfail143.stderr b/testsuite/tests/typecheck/should_fail/tcfail143.stderr index 14c73d98da..b94266978d 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail143.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail143.stderr @@ -1,8 +1,8 @@ -tcfail143.hs:29:9: error: - Couldn't match type ‘S Z’ with ‘Z’ - arising from a functional dependency between: - constraint ‘MinMax (S Z) Z Z Z’ arising from a use of ‘extend’ - instance ‘MinMax a Z Z a’ at tcfail143.hs:11:10-23 - In the expression: n1 `extend` n0 - In an equation for ‘t2’: t2 = n1 `extend` n0 +tcfail143.hs:29:6: error: + • Couldn't match type ‘S Z’ with ‘Z’ + arising from a functional dependency between: + constraint ‘MinMax (S Z) Z Z Z’ arising from a use of ‘extend’ + instance ‘MinMax a Z Z a’ at tcfail143.hs:11:10-23 + • In the expression: n1 `extend` n0 + In an equation for ‘t2’: t2 = n1 `extend` n0 diff --git a/testsuite/tests/typecheck/should_fail/tcfail153.stderr b/testsuite/tests/typecheck/should_fail/tcfail153.stderr index 8034a804fc..5f4ec3e013 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail153.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail153.stderr @@ -1,18 +1,17 @@ -
-tcfail153.hs:6:7: error:
- Couldn't match type ‘a’ with ‘Bool’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- f :: forall a. a -> [a]
- at tcfail153.hs:5:6
- Expected type: [a]
- Actual type: [Bool]
- In the expression: g x
- In an equation for ‘f’:
- f x
- = g x
- where
- g y = if y then [] else [...]
- Relevant bindings include
- x :: a (bound at tcfail153.hs:6:3)
- f :: a -> [a] (bound at tcfail153.hs:6:1)
+ +tcfail153.hs:6:9: error: + • Couldn't match expected type ‘Bool’ with actual type ‘a’ + ‘a’ is a rigid type variable bound by + the type signature for: + f :: forall a. a -> [a] + at tcfail153.hs:5:6 + • In the first argument of ‘g’, namely ‘x’ + In the expression: g x + In an equation for ‘f’: + f x + = g x + where + g y = if y then [] else [...] + • Relevant bindings include + x :: a (bound at tcfail153.hs:6:3) + f :: a -> [a] (bound at tcfail153.hs:6:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail165.hs b/testsuite/tests/typecheck/should_fail/tcfail165.hs index c23a7f39b4..8b4cabdc8e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail165.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail165.hs @@ -11,6 +11,7 @@ import Control.Concurrent -- -- In GHC 7.0 it fails again! (and rightly so) +-- With the Visible Type Application patch, this succeeds again. + foo = do var <- newEmptyMVar :: IO (MVar (forall a. Show a => a -> String)) putMVar var (show :: forall b. Show b => b -> String) - diff --git a/testsuite/tests/typecheck/should_fail/tcfail165.stderr b/testsuite/tests/typecheck/should_fail/tcfail165.stderr deleted file mode 100644 index 2b8b434385..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail165.stderr +++ /dev/null @@ -1,12 +0,0 @@ - -tcfail165.hs:15:23: - Couldn't match expected type ‘forall a. Show a => a -> String’ - with actual type ‘b0 -> String’ - In the second argument of ‘putMVar’, namely - ‘(show :: forall b. Show b => b -> String)’ - In a stmt of a 'do' block: - putMVar var (show :: forall b. Show b => b -> String) - In the expression: - do { var <- newEmptyMVar :: - IO (MVar (forall a. Show a => a -> String)); - putMVar var (show :: forall b. Show b => b -> String) } diff --git a/testsuite/tests/typecheck/should_fail/tcfail168.stderr b/testsuite/tests/typecheck/should_fail/tcfail168.stderr index e8c6c313e1..5f4656b13f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail168.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail168.stderr @@ -1,12 +1,18 @@ -tcfail168.hs:7:11: - Couldn't match expected type ‘IO a0’ - with actual type ‘Char -> IO ()’ - Probable cause: ‘putChar’ is applied to too few arguments - In a stmt of a 'do' block: putChar - In the expression: - do { putChar; - putChar 'a'; - putChar 'a'; - putChar 'a'; - .... } +tcfail168.hs:7:11: error: + • Couldn't match expected type ‘IO a0’ + with actual type ‘Char -> IO ()’ + • Probable cause: ‘putChar’ is applied to too few arguments + In a stmt of a 'do' block: putChar + In the expression: + do { putChar; + putChar 'a'; + putChar 'a'; + putChar 'a'; + .... } + In an equation for ‘foo’: + foo + = do { putChar; + putChar 'a'; + putChar 'a'; + .... } diff --git a/testsuite/tests/typecheck/should_fail/tcfail174.hs b/testsuite/tests/typecheck/should_fail/tcfail174.hs index 47c63d7248..41fc18fc66 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail174.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail174.hs @@ -7,6 +7,7 @@ data Capture a = Base a g :: Capture (forall a . a -> a) g = Base id -- Fails; need a rigid signature on 'id' + -- Actually, succeeds now, with visible type application -- This function should definitely be rejected, with or without type signature @@ -14,4 +15,3 @@ h1 = Capture g h2 :: Capture b h2 = Capture g - diff --git a/testsuite/tests/typecheck/should_fail/tcfail174.stderr b/testsuite/tests/typecheck/should_fail/tcfail174.stderr index fec5748461..e7ad3ca813 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail174.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail174.stderr @@ -1,35 +1,30 @@ -
-tcfail174.hs:9:10: error:
- Couldn't match expected type ‘forall a. a -> a’
- with actual type ‘a0 -> a0’
- In the first argument of ‘Base’, namely ‘id’
- In the expression: Base id
-
-tcfail174.hs:13:14: error:
- Couldn't match type ‘a’ with ‘a1’
- because type variable ‘a1’ would escape its scope
- This (rigid, skolem) type variable is bound by
- the type forall a2. a2 -> a2
- at tcfail174.hs:13:1-14
- Expected type: Capture (forall x. x -> a)
- Actual type: Capture (forall a. a -> a)
- In the first argument of ‘Capture’, namely ‘g’
- In the expression: Capture g
- Relevant bindings include
- h1 :: Capture a (bound at tcfail174.hs:13:1)
-
-tcfail174.hs:16:14: error:
- Couldn't match type ‘a’ with ‘b’
- ‘a’ is a rigid type variable bound by
- the type forall a1. a1 -> a1
- at tcfail174.hs:1:1
- ‘b’ is a rigid type variable bound by
- the type signature for:
- h2 :: forall b. Capture b
- at tcfail174.hs:15:7
- Expected type: Capture (forall x. x -> b)
- Actual type: Capture (forall a. a -> a)
- In the first argument of ‘Capture’, namely ‘g’
- In the expression: Capture g
- Relevant bindings include
- h2 :: Capture b (bound at tcfail174.hs:16:1)
+ +tcfail174.hs:14:14: error: + • Couldn't match type ‘a’ with ‘a1’ + because type variable ‘a1’ would escape its scope + This (rigid, skolem) type variable is bound by + the type forall a2. a2 -> a2 + at tcfail174.hs:14:1-14 + Expected type: Capture (forall x. x -> a) + Actual type: Capture (forall a. a -> a) + • In the first argument of ‘Capture’, namely ‘g’ + In the expression: Capture g + In an equation for ‘h1’: h1 = Capture g + • Relevant bindings include + h1 :: Capture a (bound at tcfail174.hs:14:1) + +tcfail174.hs:17:14: error: + • Couldn't match type ‘a’ with ‘b’ + ‘a’ is a rigid type variable bound by + the type forall a1. a1 -> a1 at tcfail174.hs:1:1 + ‘b’ is a rigid type variable bound by + the type signature for: + h2 :: forall b. Capture b + at tcfail174.hs:16:7 + Expected type: Capture (forall x. x -> b) + Actual type: Capture (forall a. a -> a) + • In the first argument of ‘Capture’, namely ‘g’ + In the expression: Capture g + In an equation for ‘h2’: h2 = Capture g + • Relevant bindings include + h2 :: Capture b (bound at tcfail174.hs:17:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail175.stderr b/testsuite/tests/typecheck/should_fail/tcfail175.stderr index 82da98bc0c..c421684b8d 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail175.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail175.stderr @@ -1,7 +1,7 @@ tcfail175.hs:11:1: error: - • Couldn't match expected type ‘String -> String -> String’ - with actual type ‘a’ + • Couldn't match expected type ‘a’ + with actual type ‘String -> String -> String’ ‘a’ is a rigid type variable bound by the type signature for: evalRHS :: forall a. Int -> a diff --git a/testsuite/tests/typecheck/should_fail/tcfail178.stderr b/testsuite/tests/typecheck/should_fail/tcfail178.stderr index 472e133098..98df425424 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail178.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail178.stderr @@ -1,14 +1,16 @@ -tcfail178.hs:15:7: - Couldn't match type ‘()’ with ‘[a]’ - Expected type: Bool -> [a] - Actual type: Bool -> () - In the first argument of ‘a’, namely ‘y’ - In the expression: a y - Relevant bindings include c :: [a] (bound at tcfail178.hs:15:1) +tcfail178.hs:15:7: error: + • Couldn't match type ‘()’ with ‘[a]’ + Expected type: Bool -> [a] + Actual type: Bool -> () + • In the first argument of ‘a’, namely ‘y’ + In the expression: a y + In an equation for ‘c’: c = a y + • Relevant bindings include c :: [a] (bound at tcfail178.hs:15:1) -tcfail178.hs:18:7: - Couldn't match expected type ‘Bool -> [a]’ with actual type ‘()’ - In the first argument of ‘a’, namely ‘()’ - In the expression: a () - Relevant bindings include d :: [a] (bound at tcfail178.hs:18:1) +tcfail178.hs:18:7: error: + • Couldn't match expected type ‘Bool -> [a]’ with actual type ‘()’ + • In the first argument of ‘a’, namely ‘()’ + In the expression: a () + In an equation for ‘d’: d = a () + • Relevant bindings include d :: [a] (bound at tcfail178.hs:18:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail179.stderr b/testsuite/tests/typecheck/should_fail/tcfail179.stderr index a50e75e6be..2a0a5bf614 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail179.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail179.stderr @@ -1,6 +1,6 @@ -tcfail179.hs:14:39: error: - • Couldn't match expected type ‘s’ with actual type ‘x’ +tcfail179.hs:14:41: error: + • Couldn't match type ‘x’ with ‘s’ ‘x’ is a rigid type variable bound by a pattern with constructor: T :: forall s x. (s -> (x -> s) -> (x, s, Int)) -> T s, @@ -10,10 +10,13 @@ tcfail179.hs:14:39: error: the type signature for: run :: forall s. T s -> Int at tcfail179.hs:12:8 - • In the first argument of ‘g’, namely ‘x’ + Expected type: x -> s + Actual type: s -> s + • In the second argument of ‘g’, namely ‘id’ In the expression: g x id + In a pattern binding: (x, _, b) = g x id • Relevant bindings include - x :: x (bound at tcfail179.hs:14:26) + x :: s (bound at tcfail179.hs:14:26) g :: s -> (x -> s) -> (x, s, Int) (bound at tcfail179.hs:14:16) ts :: T s (bound at tcfail179.hs:13:5) run :: T s -> Int (bound at tcfail179.hs:13:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index 18309c10d1..6cf22a9f61 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -1,16 +1,17 @@ tcfail181.hs:17:9: error: - Could not deduce (Monad m0) arising from a use of ‘foo’ - from the context: Monad m - bound by the inferred type of - wog :: Monad m => r -> Something (m Bool) e - at tcfail181.hs:17:1-30 - The type variable ‘m0’ is ambiguous - These potential instances exist: - instance Monad IO -- Defined in ‘GHC.Base’ - instance Monad Maybe -- Defined in ‘GHC.Base’ - instance Monad ((->) r) -- Defined in ‘GHC.Base’ - ...plus two others - (use -fprint-potential-instances to see them all) - In the expression: foo {bar = return True} - In an equation for ‘wog’: wog x = foo {bar = return True} + • Could not deduce (Monad m0) arising from a use of ‘foo’ + from the context: Monad m + bound by the inferred type of + wog :: Monad m => r -> Something (m Bool) e + at tcfail181.hs:17:1-30 + The type variable ‘m0’ is ambiguous + These potential instances exist: + instance Monad IO -- Defined in ‘GHC.Base’ + instance Monad Maybe -- Defined in ‘GHC.Base’ + instance Monad ((->) r) -- Defined in ‘GHC.Base’ + ...plus two others + (use -fprint-potential-instances to see them all) + • In the expression: foo + In the expression: foo {bar = return True} + In an equation for ‘wog’: wog x = foo {bar = return True} diff --git a/testsuite/tests/typecheck/should_fail/tcfail185.stderr b/testsuite/tests/typecheck/should_fail/tcfail185.stderr index 785b5d6dd0..f8c3c6cd99 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail185.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail185.stderr @@ -1,11 +1,17 @@ -tcfail185.hs:7:46: - Couldn't match expected type ‘Int -> Int’ with actual type ‘Bool’ - In the expression: x - In the expression: - let - y1 = y - y2 = y1 - y3 = y2 - .... - in x +tcfail185.hs:7:46: error: + • Couldn't match expected type ‘Int -> Int’ with actual type ‘Bool’ + • In the expression: x + In the expression: + let + y1 = y + y2 = y1 + y3 = y2 + .... + in x + In the expression: + \ x y + -> let + y1 = ... + .... + in x diff --git a/testsuite/tests/typecheck/should_fail/tcfail189.stderr b/testsuite/tests/typecheck/should_fail/tcfail189.stderr index 380b014947..f23243bdd0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail189.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail189.stderr @@ -1,8 +1,10 @@ -tcfail189.hs:10:31: - Couldn't match type ‘[a0]’ with ‘[a] -> [[a]]’ - Expected type: (a -> Integer) -> [a] -> [[a]] - Actual type: [a0] -> [a0] - Possible cause: ‘take’ is applied to too many arguments - In the expression: take 2 - In a stmt of a list comprehension: then group by x using take 2 +tcfail189.hs:10:31: error: + • Couldn't match type ‘[a0]’ with ‘[a] -> [[a]]’ + Expected type: (a -> Integer) -> [a] -> [[a]] + Actual type: [a0] -> [a0] + • Possible cause: ‘take’ is applied to too many arguments + In the expression: take 2 + In a stmt of a list comprehension: then group by x using take 2 + In the expression: + [length x | x <- [1 .. 10], then group by x using take 2] diff --git a/testsuite/tests/typecheck/should_fail/tcfail191.stderr b/testsuite/tests/typecheck/should_fail/tcfail191.stderr index bd1b04ca80..6b338eb5ed 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail191.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail191.stderr @@ -1,11 +1,13 @@ -
-tcfail191.hs:11:26: error:
- Couldn't match type ‘a’ with ‘[a]’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [[a]]
- at tcfail191.hs:10:9
- Expected type: [a] -> [[a]]
- Actual type: [[a]] -> [[a]]
- In the expression: take 5
- In a stmt of a list comprehension: then group using take 5
+ +tcfail191.hs:11:26: error: + • Couldn't match type ‘a’ with ‘[a]’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. [a] -> [[a]] + at tcfail191.hs:10:9 + Expected type: [a] -> [[a]] + Actual type: [[a]] -> [[a]] + • In the expression: take 5 + In a stmt of a list comprehension: then group using take 5 + In the expression: + [() | x <- [Gnorf, Brain], then group using take 5] diff --git a/testsuite/tests/typecheck/should_fail/tcfail193.stderr b/testsuite/tests/typecheck/should_fail/tcfail193.stderr index bd8ef5348a..4a96fa4aef 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail193.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail193.stderr @@ -1,11 +1,12 @@ -
-tcfail193.hs:10:31: error:
- Couldn't match type ‘a’ with ‘[a]’
- ‘a’ is a rigid type variable bound by
- a type expected by the context:
- forall a. [a] -> [a]
- at tcfail193.hs:10:10
- Expected type: [a] -> [a]
- Actual type: [a] -> [[a]]
- In the expression: inits
- In a stmt of a list comprehension: then inits
+ +tcfail193.hs:10:31: error: + • Couldn't match type ‘a’ with ‘[a]’ + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall a. [a] -> [a] + at tcfail193.hs:10:10 + Expected type: [a] -> [a] + Actual type: [a] -> [[a]] + • In the expression: inits + In a stmt of a list comprehension: then inits + In the expression: [x | x <- [3, 2, 1], then inits] diff --git a/testsuite/tests/typecheck/should_fail/tcfail198.stderr b/testsuite/tests/typecheck/should_fail/tcfail198.stderr index 58cf260593..88469939f3 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail198.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail198.stderr @@ -1,13 +1,15 @@ -
-tcfail198.hs:6:36: error:
- Couldn't match expected type ‘a2’ with actual type ‘a1’
- because type variable ‘a2’ would escape its scope
- This (rigid, skolem) type variable is bound by
- an expression type signature: a2
- at tcfail198.hs:6:36-41
- In the expression: x :: a
- In the second argument of ‘(++)’, namely ‘[x :: a]’
- Relevant bindings include
- xs :: [a1] (bound at tcfail198.hs:6:21)
- x :: a1 (bound at tcfail198.hs:6:19)
- f3 :: [a1] -> [a1] (bound at tcfail198.hs:6:6)
+ +tcfail198.hs:6:36: error: + • Couldn't match expected type ‘a2’ with actual type ‘a1’ + because type variable ‘a2’ would escape its scope + This (rigid, skolem) type variable is bound by + an expression type signature: + a2 + at tcfail198.hs:6:36-41 + • In the expression: x :: a + In the second argument of ‘(++)’, namely ‘[x :: a]’ + In the expression: xs ++ [x :: a] + • Relevant bindings include + xs :: [a1] (bound at tcfail198.hs:6:21) + x :: a1 (bound at tcfail198.hs:6:19) + f3 :: [a1] -> [a1] (bound at tcfail198.hs:6:6) diff --git a/testsuite/tests/typecheck/should_fail/tcfail201.stderr b/testsuite/tests/typecheck/should_fail/tcfail201.stderr index c19aa0c274..9aef660dbd 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail201.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail201.stderr @@ -1,14 +1,17 @@ -tcfail201.hs:17:58: error: - • Couldn't match expected type ‘a’ with actual type ‘HsDoc id0’ +tcfail201.hs:17:56: error: + • Couldn't match type ‘a’ with ‘HsDoc id0’ ‘a’ is a rigid type variable bound by the type signature for: gfoldl' :: forall (c :: * -> *) a. (forall a1 b. c (a1 -> b) -> a1 -> c b) -> (forall g. g -> c g) -> a -> c a at tcfail201.hs:15:12 - • In the first argument of ‘z’, namely ‘DocEmpty’ - In the expression: z DocEmpty + Expected type: c a + Actual type: c (HsDoc id0) + • In the expression: z DocEmpty + In a case alternative: DocEmpty -> z DocEmpty + In the expression: case hsDoc of { DocEmpty -> z DocEmpty } • Relevant bindings include hsDoc :: a (bound at tcfail201.hs:16:13) gfoldl' :: (forall a1 b. c (a1 -> b) -> a1 -> c b) diff --git a/testsuite/tests/typecheck/should_fail/tcfail204.stderr b/testsuite/tests/typecheck/should_fail/tcfail204.stderr index b6ef584387..f4b6ec791b 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail204.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail204.stderr @@ -4,7 +4,7 @@ tcfail204.hs:10:15: warning: (Fractional a0) arising from the literal ‘6.3’ at tcfail204.hs:10:15-17 (RealFrac a0) - arising from a use of ‘ceiling’ at tcfail204.hs:10:7-13 + arising from a use of ‘ceiling’ at tcfail204.hs:10:7-17 • In the first argument of ‘ceiling’, namely ‘6.3’ In the expression: ceiling 6.3 In an equation for ‘foo’: foo = ceiling 6.3 diff --git a/testsuite/tests/typecheck/should_fail/tcfail206.stderr b/testsuite/tests/typecheck/should_fail/tcfail206.stderr index 687619c9eb..e60856aaf9 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail206.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail206.stderr @@ -1,55 +1,55 @@ -
-tcfail206.hs:5:5: error:
- Couldn't match type ‘Bool’ with ‘Int’
- Expected type: Bool -> (Int, Bool)
- Actual type: Bool -> (Bool, Bool)
- In the expression: (, True)
- In an equation for ‘a’: a = (, True)
-
-tcfail206.hs:8:5: error:
- Couldn't match type ‘(Integer, Int)’ with ‘Bool -> (Int, Bool)’
- Expected type: Int -> Bool -> (Int, Bool)
- Actual type: Int -> (Integer, Int)
- In the expression: (1,)
- In an equation for ‘b’: b = (1,)
-
-tcfail206.hs:11:5: error:
- Couldn't match type ‘a’ with ‘Bool’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- c :: forall a. a -> (a, Bool)
- at tcfail206.hs:10:6
- Expected type: a -> (a, Bool)
- Actual type: a -> (a, a)
- In the expression: (True || False,)
- In an equation for ‘c’: c = (True || False,)
- Relevant bindings include
- c :: a -> (a, Bool) (bound at tcfail206.hs:11:1)
-
-tcfail206.hs:14:5: error:
- Couldn't match type ‘Bool’ with ‘Int’
- Expected type: Bool -> (# Int, Bool #)
- Actual type: Bool -> (# Bool, Bool #)
- In the expression: (# , True #)
- In an equation for ‘d’: d = (# , True #)
-
-tcfail206.hs:17:5: error:
- Couldn't match type ‘(# Integer, Int #)’
- with ‘Bool -> (# Int, Bool #)’
- Expected type: Int -> Bool -> (# Int, Bool #)
- Actual type: Int -> (# Integer, Int #)
- In the expression: (# 1, #)
- In an equation for ‘e’: e = (# 1, #)
-
-tcfail206.hs:20:5: error:
- Couldn't match type ‘a’ with ‘Bool’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- f :: forall a. a -> (# a, Bool #)
- at tcfail206.hs:19:6
- Expected type: a -> (# a, Bool #)
- Actual type: a -> (# a, a #)
- In the expression: (# True || False, #)
- In an equation for ‘f’: f = (# True || False, #)
- Relevant bindings include
- f :: a -> (# a, Bool #) (bound at tcfail206.hs:20:1)
+ +tcfail206.hs:5:5: error: + • Couldn't match type ‘Bool’ with ‘Int’ + Expected type: Bool -> (Int, Bool) + Actual type: Int -> (Int, Bool) + • In the expression: (, True) + In an equation for ‘a’: a = (, True) + +tcfail206.hs:8:5: error: + • Couldn't match type ‘(Integer, Int)’ with ‘Bool -> (Int, Bool)’ + Expected type: Int -> Bool -> (Int, Bool) + Actual type: Int -> (Integer, Int) + • In the expression: (1,) + In an equation for ‘b’: b = (1,) + +tcfail206.hs:11:5: error: + • Couldn't match type ‘a’ with ‘Bool’ + ‘a’ is a rigid type variable bound by + the type signature for: + c :: forall a. a -> (a, Bool) + at tcfail206.hs:10:6 + Expected type: a -> (a, Bool) + Actual type: Bool -> (a, Bool) + • In the expression: (True || False,) + In an equation for ‘c’: c = (True || False,) + • Relevant bindings include + c :: a -> (a, Bool) (bound at tcfail206.hs:11:1) + +tcfail206.hs:14:5: error: + • Couldn't match type ‘Bool’ with ‘Int’ + Expected type: Bool -> (# Int, Bool #) + Actual type: Int -> (# Int, Bool #) + • In the expression: (# , True #) + In an equation for ‘d’: d = (# , True #) + +tcfail206.hs:17:5: error: + • Couldn't match type ‘(# Integer, Int #)’ + with ‘Bool -> (# Int, Bool #)’ + Expected type: Int -> Bool -> (# Int, Bool #) + Actual type: Int -> (# Integer, Int #) + • In the expression: (# 1, #) + In an equation for ‘e’: e = (# 1, #) + +tcfail206.hs:20:5: error: + • Couldn't match type ‘a’ with ‘Bool’ + ‘a’ is a rigid type variable bound by + the type signature for: + f :: forall a. a -> (# a, Bool #) + at tcfail206.hs:19:6 + Expected type: a -> (# a, Bool #) + Actual type: Bool -> (# a, Bool #) + • In the expression: (# True || False, #) + In an equation for ‘f’: f = (# True || False, #) + • Relevant bindings include + f :: a -> (# a, Bool #) (bound at tcfail206.hs:20:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail208.stderr b/testsuite/tests/typecheck/should_fail/tcfail208.stderr index dd290d942c..45642a7548 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail208.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail208.stderr @@ -1,9 +1,9 @@ -
-tcfail208.hs:4:19: 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
- at tcfail208.hs:3:1-40
- In the expression: (return x == y)
- In an equation for ‘f’: f x y = (return x == y)
+ +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 + 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/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 138ac58ecc..031dad6321 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -50,7 +50,7 @@ test('tcrun031', normal, compile_and_run, ['']) test('tcrun032', normal, compile_and_run, ['']) test('tcrun033', normal, compile_and_run, ['']) test('tcrun034', normal, compile_and_run, ['']) -test('tcrun035', normal, compile_fail, ['']) +test('tcrun035', normal, compile_and_run, ['']) test('tcrun036', normal, compile_and_run, ['']) test('tcrun037', normal, compile_and_run, ['']) diff --git a/testsuite/tests/typecheck/should_run/tcrun035.stderr b/testsuite/tests/typecheck/should_run/tcrun035.stderr deleted file mode 100644 index c72ef618ab..0000000000 --- a/testsuite/tests/typecheck/should_run/tcrun035.stderr +++ /dev/null @@ -1,11 +0,0 @@ - -tcrun035.hs:13:7: - Couldn't match type ‘IO a’ - with ‘forall (m :: * -> *). Monad m => m a’ - Expected type: (forall (m :: * -> *). Monad m => m a) -> IO a - Actual type: IO a -> IO a - In the expression: id . id - In an equation for ‘foo’: foo = id . id - Relevant bindings include - foo :: (forall (m :: * -> *). Monad m => m a) -> IO a - (bound at tcrun035.hs:13:1) |