Simon Peyton Jones pushed to branch wip/T23162-spj at Glasgow Haskell Compiler / GHC
Commits:
-
8e2a2e57
by Simon Peyton Jones at 2025-08-16T09:51:36+01:00
-
b8d5945f
by Simon Peyton Jones at 2025-08-16T23:18:43+01:00
16 changed files:
- compiler/GHC/Utils/Outputable.hs
- testsuite/tests/deriving/should_fail/T3621.stderr
- testsuite/tests/indexed-types/should_fail/T9662.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail10.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr
- testsuite/tests/parser/should_fail/T20654a.stderr
- testsuite/tests/partial-sigs/should_fail/T14040a.stderr
- testsuite/tests/typecheck/no_skolem_info/T14040.stderr
- testsuite/tests/typecheck/should_fail/FD3.stderr
- testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr
- testsuite/tests/typecheck/should_fail/T13506.stderr
- testsuite/tests/typecheck/should_fail/T19415b.stderr
- testsuite/tests/typecheck/should_fail/T5246.stderr
- testsuite/tests/typecheck/should_fail/T5978.stderr
- testsuite/tests/typecheck/should_fail/T8603.stderr
- testsuite/tests/typecheck/should_fail/T9612.stderr
Changes:
| ... | ... | @@ -522,20 +522,22 @@ pprDeeper d = SDoc $ \ctx -> case sdocStyle ctx of |
| 522 | 522 | _ -> runSDoc d ctx
|
| 523 | 523 | |
| 524 | 524 | |
| 525 | --- | Truncate a list that is longer than the default depth
|
|
| 525 | +-- | Trim the list to the length of the remaining depth count
|
|
| 526 | 526 | pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc
|
| 527 | 527 | pprDeeperList f ds
|
| 528 | 528 | | null ds = f []
|
| 529 | 529 | | otherwise = SDoc work
|
| 530 | 530 | where
|
| 531 | - -- Trim the list to the length of the remaining depth count
|
|
| 532 | - work ctx@SDC{ sdocStyle=PprUser _ depth _ }
|
|
| 533 | - | Just list_elts_to_print
|
|
| 531 | + work ctx@SDC{ sdocStyle=PprUser q depth c }
|
|
| 532 | + | Just n_remaining
|
|
| 534 | 533 | <- case depth of
|
| 535 | 534 | DefaultDepth -> Just (sdocDefaultDepth ctx)
|
| 536 | 535 | PartWay n -> Just n
|
| 537 | 536 | AllTheWay -> Nothing
|
| 538 | - = runSDoc (f (trim list_elts_to_print ds)) ctx
|
|
| 537 | + = runSDoc (f (trim n_remaining ds))
|
|
| 538 | + -- Trim the length of the list
|
|
| 539 | + (ctx { sdocStyle = PprUser q (PartWay (n_remaining - 1)) c })
|
|
| 540 | + -- ..and go deeper as we step inside the list elements
|
|
| 539 | 541 | |
| 540 | 542 | work other_ctx = runSDoc (f ds) other_ctx
|
| 541 | 543 |
| 1 | -T3621.hs:24:43: error: [GHC-25897]
|
|
| 2 | - • Couldn't match type ‘s’ with ‘state’
|
|
| 3 | - arising from a functional dependency between:
|
|
| 4 | - constraint ‘MonadState state (State s)’
|
|
| 5 | - arising from the 'deriving' clause of a data type declaration
|
|
| 6 | - instance ‘MonadState s1 (State s1)’ at T3621.hs:21:10-31
|
|
| 7 | - ‘s’ is a rigid type variable bound by
|
|
| 8 | - the deriving clause for ‘MonadState state (WrappedState s)’
|
|
| 9 | - at T3621.hs:24:43-58
|
|
| 10 | - ‘state’ is a rigid type variable bound by
|
|
| 11 | - the deriving clause for ‘MonadState state (WrappedState s)’
|
|
| 12 | - at T3621.hs:24:43-58
|
|
| 1 | +T3621.hs:24:43: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘MonadState state (State s)’
|
|
| 3 | + arising from the 'deriving' clause of a data type declaration
|
|
| 4 | + Possible fix:
|
|
| 5 | + use a standalone 'deriving instance' declaration,
|
|
| 6 | + so you can specify the instance context yourself
|
|
| 13 | 7 | • When deriving the instance for (MonadState
|
| 14 | 8 | state (WrappedState s))
|
| 15 | 9 |
| 1 | 1 | T9662.hs:49:8: error: [GHC-25897]
|
| 2 | - • Couldn't match type ‘n’ with ‘Int’
|
|
| 2 | + • Couldn't match type ‘k’ with ‘Int’
|
|
| 3 | 3 | Expected: Exp (((sh :. k) :. m) :. n)
|
| 4 | 4 | -> Exp (((sh :. m) :. n) :. k)
|
| 5 | 5 | Actual: Exp
|
| 6 | 6 | (Tuple (((Atom a0 :. Atom Int) :. Atom Int) :. Atom Int))
|
| 7 | 7 | -> Exp
|
| 8 | 8 | (Plain (((Unlifted (Atom a0) :. Exp Int) :. Exp Int) :. Exp Int))
|
| 9 | - ‘n’ is a rigid type variable bound by
|
|
| 9 | + ‘k’ is a rigid type variable bound by
|
|
| 10 | 10 | the type signature for:
|
| 11 | 11 | test :: forall sh k m n.
|
| 12 | 12 | Shape (((sh :. k) :. m) :. n) -> Shape (((sh :. m) :. n) :. k)
|
| 1 | - |
|
| 2 | -RecordDotSyntaxFail10.hs:40:11: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Int’ with ‘[Char]’
|
|
| 1 | +RecordDotSyntaxFail10.hs:40:11: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘HasField "quux" Quux String’
|
|
| 4 | 3 | • In the second argument of ‘($)’, namely ‘a {foo.bar.baz.quux}’
|
| 5 | 4 | In a stmt of a 'do' block: print $ a {foo.bar.baz.quux}
|
| 6 | 5 | In the expression:
|
| 7 | - do let a = ...
|
|
| 6 | + do let a = Foo {foo = Bar {bar = ...}}
|
|
| 8 | 7 | let quux = "Expecto patronum!"
|
| 9 | 8 | print $ a {foo.bar.baz.quux}
|
| 9 | + |
| 1 | - |
|
| 2 | -RecordDotSyntaxFail13.hs:26:11: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Int’ with ‘Foo -> Int’
|
|
| 4 | - arising from a functional dependency between:
|
|
| 5 | - constraint ‘HasField "foo" Foo (Foo -> Int)’
|
|
| 6 | - arising from a record update
|
|
| 7 | - instance ‘HasField "foo" Foo Int’
|
|
| 8 | - at RecordDotSyntaxFail13.hs:21:10-31
|
|
| 1 | +RecordDotSyntaxFail13.hs:26:11: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘HasField "foo" Foo (Foo -> Int)’
|
|
| 3 | + arising from a record update
|
|
| 4 | + (maybe you haven't applied a function to enough arguments?)
|
|
| 9 | 5 | • In the second argument of ‘($)’, namely ‘a {foo}’
|
| 10 | 6 | In a stmt of a 'do' block: print $ a {foo}
|
| 11 | 7 | In the expression:
|
| 12 | - do let a = ...
|
|
| 8 | + do let a = Foo {foo = 12}
|
|
| 13 | 9 | print $ a {foo}
|
| 10 | + |
| 1 | - |
|
| 2 | -T20654a.hs:7:9: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type: forall a. a -> a
|
|
| 4 | - with: Int -> Int
|
|
| 5 | - arising from a functional dependency between constraints:
|
|
| 6 | - ‘?poly::Int -> Int’
|
|
| 7 | - arising from a use of implicit parameter ‘?poly’ at T20654a.hs:7:9-13
|
|
| 8 | - ‘?poly::forall a. a -> a’
|
|
| 9 | - arising from the type signature for:
|
|
| 10 | - foo :: (?poly::forall a. a -> a) => Int -> Int at T20654a.hs:6:1-48
|
|
| 1 | +T20654a.hs:7:9: error: [GHC-91416]
|
|
| 2 | + • Could not deduce ‘?poly::Int -> Int’
|
|
| 3 | + arising from a use of implicit parameter ‘?poly’
|
|
| 4 | + from the context: ?poly::forall a. a -> a
|
|
| 5 | + bound by the type signature for:
|
|
| 6 | + foo :: (?poly::forall a. a -> a) => Int -> Int
|
|
| 7 | + at T20654a.hs:6:1-48
|
|
| 11 | 8 | • In the expression: ?poly x
|
| 12 | 9 | In an equation for ‘foo’: foo x = ?poly x
|
| 10 | + |
| 1 | 1 | T14040a.hs:26:46: error: [GHC-46956]
|
| 2 | - • Couldn't match kind ‘k0’ with ‘WeirdList z’
|
|
| 3 | - Expected kind ‘WeirdList k0’,
|
|
| 2 | + • Couldn't match kind ‘k1’ with ‘WeirdList z’
|
|
| 3 | + Expected kind ‘WeirdList k1’,
|
|
| 4 | 4 | but ‘xs’ has kind ‘WeirdList (WeirdList z)’
|
| 5 | 5 | because kind variable ‘z’ would escape its scope
|
| 6 | 6 | This (rigid, skolem) kind variable is bound by
|
| ... | ... | @@ -24,8 +24,8 @@ T14040a.hs:26:46: error: [GHC-46956] |
| 24 | 24 | -> p _ wl
|
| 25 | 25 | |
| 26 | 26 | T14040a.hs:27:27: error: [GHC-46956]
|
| 27 | - • Couldn't match kind ‘k1’ with ‘z’
|
|
| 28 | - Expected kind ‘WeirdList k1’,
|
|
| 27 | + • Couldn't match kind ‘k0’ with ‘z’
|
|
| 28 | + Expected kind ‘WeirdList k0’,
|
|
| 29 | 29 | but ‘WeirdCons x xs’ has kind ‘WeirdList z’
|
| 30 | 30 | because kind variable ‘z’ would escape its scope
|
| 31 | 31 | This (rigid, skolem) kind variable is bound by
|
| 1 | 1 | T14040.hs:27:46: error: [GHC-46956]
|
| 2 | - • Couldn't match kind ‘k0’ with ‘WeirdList z’
|
|
| 3 | - Expected kind ‘WeirdList k0’,
|
|
| 2 | + • Couldn't match kind ‘k1’ with ‘WeirdList z’
|
|
| 3 | + Expected kind ‘WeirdList k1’,
|
|
| 4 | 4 | but ‘xs’ has kind ‘WeirdList (WeirdList z)’
|
| 5 | 5 | because kind variable ‘z’ would escape its scope
|
| 6 | 6 | This (rigid, skolem) kind variable is bound by
|
| ... | ... | @@ -24,8 +24,8 @@ T14040.hs:27:46: error: [GHC-46956] |
| 24 | 24 | -> p _ wl
|
| 25 | 25 | |
| 26 | 26 | T14040.hs:28:27: error: [GHC-46956]
|
| 27 | - • Couldn't match kind ‘k1’ with ‘z’
|
|
| 28 | - Expected kind ‘WeirdList k1’,
|
|
| 27 | + • Couldn't match kind ‘k0’ with ‘z’
|
|
| 28 | + Expected kind ‘WeirdList k0’,
|
|
| 29 | 29 | but ‘WeirdCons x xs’ has kind ‘WeirdList z’
|
| 30 | 30 | because kind variable ‘z’ would escape its scope
|
| 31 | 31 | This (rigid, skolem) kind variable is bound by
|
| 1 | - |
|
| 2 | -FD3.hs:15:15: error: [GHC-25897]
|
|
| 3 | - • Couldn't match type ‘a’ with ‘(String, a)’
|
|
| 4 | - arising from a functional dependency between:
|
|
| 5 | - constraint ‘MkA (String, a) a’ arising from a use of ‘mkA’
|
|
| 6 | - instance ‘MkA a1 a1’ at FD3.hs:12:10-16
|
|
| 7 | - ‘a’ is a rigid type variable bound by
|
|
| 8 | - the type signature for:
|
|
| 9 | - translate :: forall a. (String, a) -> A a
|
|
| 10 | - at FD3.hs:14:1-31
|
|
| 1 | +FD3.hs:15:15: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘MkA (String, a) a’ arising from a use of ‘mkA’
|
|
| 11 | 3 | • In the expression: mkA a
|
| 12 | 4 | In an equation for ‘translate’: translate a = mkA a
|
| 13 | - • Relevant bindings include
|
|
| 14 | - a :: (String, a) (bound at FD3.hs:15:11)
|
|
| 15 | - translate :: (String, a) -> A a (bound at FD3.hs:15:1) |
|
| 5 | + |
| 1 | - |
|
| 2 | -FDsFromGivens2.hs:15:15: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Char’ with ‘[a]’
|
|
| 4 | - arising from a functional dependency between constraints:
|
|
| 5 | - ‘C Char [a]’ arising from a use of ‘f’ at FDsFromGivens2.hs:15:15
|
|
| 6 | - ‘C Char Char’
|
|
| 7 | - arising from a pattern with constructor:
|
|
| 8 | - KCC :: C Char Char => () -> KCC,
|
|
| 9 | - in an equation for ‘bar’ at FDsFromGivens2.hs:15:6-10
|
|
| 1 | +FDsFromGivens2.hs:15:15: error: [GHC-39999]
|
|
| 2 | + • Could not deduce ‘C Char [a]’ arising from a use of ‘f’
|
|
| 3 | + from the context: C Char Char
|
|
| 4 | + bound by a pattern with constructor:
|
|
| 5 | + KCC :: C Char Char => () -> KCC,
|
|
| 6 | + in an equation for ‘bar’
|
|
| 7 | + at FDsFromGivens2.hs:15:6-10
|
|
| 10 | 8 | • In the expression: f
|
| 11 | 9 | In an equation for ‘bar’: bar (KCC _) = f
|
| 12 | - • Relevant bindings include
|
|
| 13 | - bar :: KCC -> a -> a (bound at FDsFromGivens2.hs:15:1) |
|
| 10 | + |
| 1 | - |
|
| 2 | -T13506.hs:16:12: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Char’ with ‘()’
|
|
| 4 | - arising from a functional dependency between:
|
|
| 5 | - constraint ‘FunDep [Char] ()’ arising from a use of ‘singleton’
|
|
| 6 | - instance ‘FunDep [a] a’ at T13506.hs:5:10-21
|
|
| 1 | +T13506.hs:16:12: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘FunDep [Char] ()’
|
|
| 3 | + arising from a use of ‘singleton’
|
|
| 7 | 4 | • In the expression: singleton ()
|
| 8 | 5 | In an equation for ‘illTyped’: illTyped = singleton ()
|
| 6 | + |
| 1 | - |
|
| 2 | -T19415b.hs:15:8: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Int’ with ‘Char’
|
|
| 4 | - arising from a functional dependency between:
|
|
| 5 | - constraint ‘Ping (T a0) (T b) Char’ arising from a use of ‘foo’
|
|
| 6 | - instance ‘Ping (T a) (T b1) Int’ at T19415b.hs:12:10-53
|
|
| 1 | +T19415b.hs:15:8: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘Ping (T a0) (T b0) Char’
|
|
| 3 | + arising from a use of ‘foo’
|
|
| 7 | 4 | • In the expression: foo 'c' MkT
|
| 8 | 5 | In an equation for ‘loop’: loop = foo 'c' MkT
|
| 6 | + |
| 1 | - |
|
| 2 | -T5246.hs:11:10: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘[Char]’ with ‘Int’
|
|
| 4 | - arising from a functional dependency between constraints:
|
|
| 5 | - ‘?x::Int’ arising from a use of ‘foo’ at T5246.hs:11:10-12
|
|
| 6 | - ‘?x::String’
|
|
| 7 | - arising from the implicit-parameter binding for ?x at T5246.hs:(10,7)-(11,12)
|
|
| 1 | +T5246.hs:11:10: error: [GHC-91416]
|
|
| 2 | + • Could not deduce ‘?x::Int’ arising from a use of ‘foo’
|
|
| 3 | + from the context: ?x::String
|
|
| 4 | + bound by the implicit-parameter binding for ?x
|
|
| 5 | + at T5246.hs:(10,7)-(11,12)
|
|
| 8 | 6 | • In the expression: foo
|
| 9 | 7 | In the expression: let ?x = "hello" in foo
|
| 10 | 8 | In an equation for ‘bar’: bar = let ?x = "hello" in foo
|
| 9 | + |
| 1 | - |
|
| 2 | -T5978.hs:22:11: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type ‘Bool’ with ‘Char’
|
|
| 4 | - arising from a functional dependency between:
|
|
| 5 | - constraint ‘C Double Char’ arising from a use of ‘polyBar’
|
|
| 6 | - instance ‘C Double Bool’ at T5978.hs:8:10-22
|
|
| 1 | +T5978.hs:22:11: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘C Double Char’ arising from a use of ‘polyBar’
|
|
| 7 | 3 | • In the expression: polyBar id monoFoo
|
| 8 | 4 | In an equation for ‘monoBar’: monoBar = polyBar id monoFoo
|
| 5 | + |
| ... | ... | @@ -3,8 +3,8 @@ T8603.hs:33:17: error: [GHC-18872] |
| 3 | 3 | When matching types
|
| 4 | 4 | m0 :: * -> *
|
| 5 | 5 | [a2] :: *
|
| 6 | - Expected: [a2] -> StateT s RV a1
|
|
| 7 | - Actual: t0 m0 (StateT s RV a1)
|
|
| 6 | + Expected: [a2] -> StateT s RV a0
|
|
| 7 | + Actual: t0 m0 (StateT s RV a0)
|
|
| 8 | 8 | • The function ‘lift’ is applied to two visible arguments,
|
| 9 | 9 | but its type ‘(Control.Monad.Trans.Class.MonadTrans t, Monad m) =>
|
| 10 | 10 | m a -> t m a’
|
| 1 | - |
|
| 2 | -T9612.hs:16:9: error: [GHC-18872]
|
|
| 3 | - • Couldn't match type: [(Int, a)]
|
|
| 4 | - with: (Int, a)
|
|
| 5 | - arising from a functional dependency between:
|
|
| 6 | - constraint ‘MonadWriter (Int, a) (WriterT [(Int, a)] Identity)’
|
|
| 7 | - arising from a use of ‘tell’
|
|
| 8 | - instance ‘MonadWriter w (WriterT w m)’ at T9612.hs:20:10-59
|
|
| 1 | +T9612.hs:16:9: error: [GHC-39999]
|
|
| 2 | + • Could not deduce ‘MonadWriter
|
|
| 3 | + (Int, a) (WriterT [(Int, a)] Identity)’
|
|
| 4 | + arising from a use of ‘tell’
|
|
| 5 | + from the context: Eq a
|
|
| 6 | + bound by the type signature for:
|
|
| 7 | + f :: forall a. Eq a => a -> (Int, a) -> Writer [(Int, a)] (Int, a)
|
|
| 8 | + at T9612.hs:13:1-57
|
|
| 9 | 9 | • In a stmt of a 'do' block: tell (n, x)
|
| 10 | 10 | In the expression:
|
| 11 | 11 | do tell (n, x)
|
| ... | ... | @@ -14,8 +14,4 @@ T9612.hs:16:9: error: [GHC-18872] |
| 14 | 14 | f y (n, x)
|
| 15 | 15 | = do tell (n, x)
|
| 16 | 16 | return (1, y)
|
| 17 | - • Relevant bindings include
|
|
| 18 | - x :: a (bound at T9612.hs:14:8)
|
|
| 19 | - y :: a (bound at T9612.hs:14:3)
|
|
| 20 | - f :: a -> (Int, a) -> Writer [(Int, a)] (Int, a)
|
|
| 21 | - (bound at T9612.hs:14:1) |
|
| 17 | + |