[Haskell-cafe] shorter error messages

stuebinm stuebinm at disroot.org
Tue Mar 16 15:58:47 UTC 2021


I've found this problem to be largely solved when using the haskell 
language server with the emacs lsp mode — it just marks whatever call 
would throw a type error and gives you a (usually) reasonably short hint 
of what went wrong. So far I've also not seen any false alerts — but 
then I've only been using it for a week or so, so maybe I just haven't 
run into them yet.

Of course, this doesn't really help if you really want to just use ghc 
by itself, but perhaps it would be possible to write some minimal client 
for the language server which just shows you the errors?

Barring that, I guess you /could/ do something like
   $ ghc 2>&1 | grep "Couldn't match" -A 4
to get a list of type errors, but that's rarely actually useful ...

stuebinm


On 16.03.21 16:21, Carter Schonwald wrote:
> I don’t think so! But it’s a great idea perhaps!  How do other tools do 
> it? And or is there a bread crumb you could do find next/previous match 
> on the current output for? Or is that missing and the real issue to address?
> 
> On Tue, Mar 16, 2021 at 9:02 AM Ben Franksen <ben.franksen at online.de 
> <mailto:ben.franksen at online.de>> wrote:
> 
>     Is there a way to tell ghc to print errors, especially type errors in a
>     more concise way? Ideally one or two lines of text? I hate it when I
>     have to scroll several pages of text just to see the next/previous error
>     location.
> 
>     Cheers
>     Ben
>     -- 
>     Niemand hat das Recht zu gehorchen. -- Hannah Arendt
> 
>     _______________________________________________
>     Haskell-Cafe mailing list
>     To (un)subscribe, modify options or view archives go to:
>     http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>     <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.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x695C841098BECF1D.asc
Type: application/pgp-keys
Size: 3131 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210316/b533f9a3/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210316/b533f9a3/attachment.sig>


More information about the Haskell-Cafe mailing list