haskell / haskell/error-messages

Add to build-depends in your cabal file

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

Description

[A recent question on stackoverflow](https://stackoverflow.com/q/71283895/15207568) concerns adding dependencies to the cabal file. The error suggests adding a dependency to the `build-depends` field:

```
src\Main.hs:3:2: error:
Could not load module `Text.ParserCombinators.Parsec'
It is a member of the hidden package `parsec-3.1.13.0'.
Perhaps you need to add `parsec' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
|
3 | import Text.ParserCombinators.Parsec hiding (spaces)
| ^^
```

However, the .cabal file could contain multiple `build-depends` fields, so it would be useful if the error message could include slightly more information about the build component and perhaps even a line number in the .cabal file.

That does seem to require some coordination between GHC and Cabal. Maybe with structured error messages GHC could provide a generic "package not found" error and then cabal could intercept that and provide detailed information on how to solve that. That seems like quite a big change, so maybe there is an easier solution?

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.