haskell / haskell/cabal

Improve "Error: cabal: can't find source for ..." message

Open
#8,935 12 comments 0 reactions 0 assignees Claimed by @kylixafonso View on GitHub
re: error-message type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
This is less of a bug report and more of an improvement suggestion. I'm an intern Haskell dev and am currently alternating between PureScript and Haskell for different projects with different requirements. For Haskell, the file extension is ".hs" and for PureScript, it's ".purs". Out of distraction, I accidentally renamed one of the modules in a Haskell project to "Module.purs". It took me 2 hours to realize that this is what had happened because the error message "Error: cabal: can't find source for ..." is IMO a bit too generic and vague (take in account, this improvement suggestion is more beginner-oriented). It'd be nice if you could add something along the lines of "closest matches: 'Module.purs', 'Module1.hs', ..." to inform the user that there are files that have very similar names in the project but don't 1:1 match the module being searched for.

**To Reproduce**
Steps to reproduce the behavior:

Create a "Module.{extension that isn't hs or lhs}" file under src and in cabal target write "exposed-modules: Module".

```
$ cabal v2-build {name of target}
```

**Expected behavior**
Error message is prompted saying something along the lines of: "Error: cabal: can't find source for 'Module', closest matches to expected file for module are: 'Module.purs'".

**System information**
- `NixOS 21.05`
- `cabal 3.8.1.0`
- `ghc 9.2.5`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.