src-lib/Foo.hs:296:3: error: [GHC-83865]
• Couldn't match type: [[RestTable]]
with: ExceptT RestProblem m [RestTable]
Expected: t0 [[RestTable]] -> ExceptT RestProblem m [RestTable]
Actual: t0 [[RestTable]] -> [[RestTable]]
• In the first argument of ‘(<$>)’, namely ‘concat’
In the first argument of ‘($)’, namely
‘concat <$> forLimitedConcurrentlyEIO 10 _scDatasets’
In the expression:
concat <$> forLimitedConcurrentlyEIO 10 _scDatasets
$ getTablesForDataSetViaInformationSchema _scConnection
• Relevant bindings include
getTablesFast :: BigQuerySourceConfig
-> ExceptT RestProblem m [RestTable]
(bound at src-lib/Foo.hs:295:1)
|
296 | concat <$>
| ^^^^^^
I mean we already have the token and line number right there at the bottom. I’m not sure I’ve ever read that “relevant bindings include…” section either. Also sometimes these sections are really huge IIRC
Just thought I’d post here before raising a proposal or trying to just open a PR.
It’s probably fine to remove In the first argument of […] In the expression: […], but in that case I’d want to capture more lines of context at the bottom.
The Relevant bindings section sometimes contains important clues, like the providence of key type variables.
The error could come from one of many positions in many files, and is not necessarily visible without me going looking for it. I’d rather have enough context to understand the issue before I decide whether or not to do so.
It’s good in a different development mode, when you’re using typed holes trying to piece together something difficult and then the bindings in scope and their types lets you piece together that puzzle. But I’d agree in your particular example, you just want to know what the offending code and don’t care about the rest.
Edit: yes, @jberryman I meant the relevant bindings. Saves me adding a comment to say “yes”.
By “it” you mean the “relevant bindings include…” section? (The “In the Nth argument of …” section doesn’t have types, it’s just an english language description of the syntactic structure surrounding the error afaiu)
+1. Since we have the exact expression highlighted at the bottom, I think we can get rid of the first bullet entirely and add more to Relevant bindings:
src-lib/Foo.hs:296:3: error: [GHC-83865]
• Couldn't match type: [[RestTable]]
with: ExceptT RestProblem m [RestTable]
Expected: t0 [[RestTable]] -> ExceptT RestProblem m [RestTable]
Actual: t0 [[RestTable]] -> [[RestTable]]
• Relevant bindings include
concat :: t0 [[RestTable]] -> [[RestTable]]
(<$>) :: (t0 [[RestTable]] -> ExceptT RestProblem m [RestTable])
-> ExceptT RestProblem m (t0 [[RestTable]])
-> ExceptT RestProblem m [[RestTable]]
getTablesFast :: BigQuerySourceConfig
-> ExceptT RestProblem m [RestTable]
(bound at src-lib/Foo.hs:295:1)
|
296 | concat <$>
| ^^^^^^
Thank you for mentioning those flags. I will start using them at once. I find almost all the stuff in the type error messages totally useless.
Also, I dislike that one type error gives me many type error messages at different locations. I’d prefer just one (which, sadly, sometimes is not the first one). Compiler, just give up after the first type error!
Yes. It’s a bit of a shame that that has stalled. It really shouldn’t be hard in principle.
More generally, what we actually need is for someone to finally migrate the core of HLS to use structured diagnostics, instead of all the horrific string manipulation that is currently going on. These were added a few GHC versions ago, but I suspect it’s an awful lot of work to move everything over. Plus there’s a lot of potential for bikeshedding exactly what information should be shown in the editor. Hopefully it could be done gradually.
HLS uses GHC-the-library, and that library now represents errors and warnings as a proper ADT rather than effectively as strings. But HLS still only knows how to deal with the strings, so since the ADTs were added, it just prints them and tries to parse the results.