haskell / haskell/error-messages
Don't suggest adding constraints to methods and/or functions from other packages
- Dominant language
- No language data
- Stars
- 76
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
[This stackoverflow question](https://stackoverflow.com/q/72304990/15207568) shows an error message with a very inappropriate suggestion:
```haskell
src/LatticePoint.hs:12:14: error:
• No instance for (Eq a)
Possible fix:
add (Eq a) to the context of
the type signature for:
fmap :: forall a b. (a -> b) -> LatticePoint a -> LatticePoint b
• When checking that instance signature for ‘fmap’
is more general than its signature in the class
Instance sig: forall a b.
(Eq a, Eq b) =>
(a -> b) -> LatticePoint a -> LatticePoint b
Class sig: forall a b.
(a -> b) -> LatticePoint a -> LatticePoint b
In the instance declaration for ‘Functor LatticePoint’
|
12 | fmap :: (Eq a, Eq b) => (a -> b) -> LatticePoint a -> LatticePoint b
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
I think there are at least two things wrong with this message:
1. It suggests changing code in another package
2. It suggests changing methods of a type class
I'd estimate suggestions that do either of those are very rarely the right way to fix the problem.
My suggestion would be to at least stop this possible fix from being shown and if possible show a better explanation instead.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.