haskell / haskell/error-messages

Don't suggest turning on typeclass extensions that don't help

Open
#46 2 comments 4 reactions 0 assignees View on GitHub
status:Composing error message tool:GHC type:error-message
Dominant language
No language data
Stars
76
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Returning to the example from: https://github.com/haskell/error-messages/issues/42 , when FlexibleInstances is already on we get the not-that-bad error

```
ghci> 1 + [2,3]

:6:1: error:
* No instance for (Num [a0]) arising from a use of `it'
* In a stmt of an interactive GHCi command: print it
```

But when FlexibleInstances is not yet on, we instead get an error suggesting we turn it on!

I think that errors which suggest some typeclass extension should be turned on (at call sites, not instance declarations) should first check if the extension would help -- i.e. if the code would typecheck _with_ the extension. If it still would not typecheck with the extension, then the error message should be about the failure to typecheck, not the extension that requires it.

This seems like a reasonable-to-implement principle which could potentially improve a broad class of error messages.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.