haskell / haskell/error-messages

Overlapping instances errors can be improved

Open
#552 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
76
Forks
19
PR merge metrics
No merged PRs in 30d

Description

This issue is inspired by this question on discourse: https://discourse.haskell.org/t/issue-with-overlapping-instances/11467?u=jaror

Here are some short notes on how the message could be improved:

* If kind variables play an essential role in rejecting overlap, then they should be printed in the message!
* Ideally, the message would clearly indicate which parts of the instance heads cause the conflicting specificity. For example here's how I'd improve this specific message manually:
```
An overlapping instance can only be chosen when it is strictly more specific.
The first instance that follows overlaps the second, but neither is more specific than the other:
instance [overlappable] (...) Embeds @{k} (t n) (t m)
instance [overlapping] (...) Embeds @{*} n (t m)
^ ^
| +-- 't n' is more specific than 'n'
+----- 'k' is less specific than '*'
```

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.