Cross-cutting concerns between GHC & Cabal regarding Unit IDs & GHC reporting
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Context: When reporting about unused packages, GHC currently doesn't insert any information about the cabal component that is faulty. This results in an unhelpful output when multiple components get caught by the `-Wunused-packages` flag.
This is a behaviour that was reported in [this GHC ticket](https://gitlab.haskell.org/ghc/ghc/-/issues/21106), in which @mpickering and @michaelpj gave helpful insights.
In the discussion, @mpickering suggests that GHC could insert Unit IDs in the location part of a diagnostic.
This would make it appear as
```
Cabal-3.6.0.0-: error: [-Wunused-packages, -Werror=unused-packages]
The following packages were specified via -package or -package-id flags,
but were not needed for compilation:
- postgresql-simple-0.6.4
```
and especially notes about unit Ids:
> It's an internal detail. I suggest that it's up to Cabal to more clearly separate the output into components with readable names if desired
I think this is one case where such a distinction is desired. An optimal output would be:
```
lib:libraryName: error: [-Wunused-packages, -Werror=unused-packages]
The following packages were specified via -package or -package-id flags,
but were not needed for compilation:
- postgresql-simple-0.6.4
```
Contributor guide
Research direction
Start by reviewing the linked GHC ticket and the discussion about Unit IDs and diagnostic locations. Define the Cabal/GHC boundary and consider how component-readable names should appear; done means unused-package diagnostics identify the affected Cabal component clearly when multiple components are involved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100