[Haskell-cafe] shorter error messages

Richard Eisenberg rae at richarde.dev
Wed Mar 17 13:30:30 UTC 2021


In the short-term: I'll take option 3. We've already changed some of the datatypes around there, and the new output reflects the new structure. I did poke around a bit (https://gitlab.haskell.org/ghc/ghc/-/issues/19278) asking if anyone relied on the existing structure, and we were told just to update as we saw fit.

In the longer-term: Option 1. The JSON feature is, essentially, undesigned. It just happened. There is no real specification or supported story for what tools are likely to consume the data. After this overhaul, it will be easy to imagine arbitrarily structured and informative JSON output, and so I imagine we'll start a conversation with consumers (i.e. IDEs and similar tools) to design an advertised interface. This interface will need to be somewhat unstable in perpetuity, as GHC improves errors, adds new ones, etc. But my hope is that the stated design encompasses this need for change and specifies what will and will not change over time. Maybe even there will be a way to query GHC for its JSON schema? Not sure.

An important detail is that the flag for JSON output is -ddump-json, starting with a `d`; this means it's in the "debugging GHC" section of the manual. I hope that changes someday (where "hope" implies that I will actively support efforts at doing so).

Richard

> On Mar 16, 2021, at 6:01 PM, Sebastiaan Joosten <sjcjoosten at gmail.com> wrote:
> 
> Hi Richard,
> 
> this raises a question about the upcoming overhaul: is the JSON dump format following -ddump-json most likely to:
> 1. change a lot (complete overhaul is likely  and/or feature might disappear - say because all datatypes will be changed and the JSON is just some 'deriving Generic' ToJSON dump with default parameters)
> 2. stay the same mostly (if/wherever it changes, it is either a bug or deliberate feature)
> 3. change in minor ways (stability is not considered important in the overhaul but there are no reasons to believe this part of the code will be affected much)
> ?
> 
> What would your guess be?
> 
> Sebastiaan
> 
> PS: feel free to reply to cafe if that seems fitting – my mails there get rejected (issue on my end)
> 
>> On 16 Mar 2021, at 14:07, Richard Eisenberg <rae at richarde.dev> wrote:
>> 
>> There is no "official" way to accommodate this reasonable request. The ideas up-thread are good ones.
>> 
>> I want to pipe in that we're currently going through an internal overhaul of error-message handling that will make such a request much easier to contemplate in the future. This is active work going on right now. So there is hope, possibly for 9.4. Of course, once the internal overhaul is done, we'll need to design any features that actually change the output -- the overhaul just makes it easy to implement such features (which would be very difficult at the moment).
>> 
>> Richard
>> 
>>> On Mar 16, 2021, at 12:56 PM, Jaro Reinders <jaro.reinders at gmail.com> wrote:
>>> 
>>> On 16-03-2021 17:40, Tom Smeding wrote:
>>>> In any case, the haskell language server just uses GHC internally, so it just shortens the GHC message. But then I believe the same result could be accomplished by some simple text manipulation on GHC's normal output.
>>> 
>>> In fact, you can use -ddump-json to get JSON error messages. I should be easy to convert that to any form you like.
>>> 
>>> But there is no clear specification of that output:
>>> https://gitlab.haskell.org/ghc/ghc/-/issues/19278
>>> 
>>> And I also want to point out that there is a big open issue for better error messages:
>>> https://gitlab.haskell.org/ghc/ghc/-/issues/8809
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>> 
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> 



More information about the Haskell-Cafe mailing list