haskell / haskell/cabal

[RFC] Introduce name-agnostic package filename

Open
#6,299 12 comments 4 reactions 0 assignees View on GitHub
Cabal: other type: discussion type: RFC
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

If I have a package called `foo` the `.cabal` file for this package **must** be called `foo.cabal`. For the package `bar` it **must** be named `bar.cabal`. So the name of the file that describes package metadata should be the same as the package name. This is a minor inconvenience that makes it harder to write tooling and interact with packages:

1. If I want to change the project name, I also need to change the filename.
2. Tools that work with Haskell source code and want to read fields like `default-extension` can't just read a single file, and they need to filter files with the `.cabal` extension and do extra work.
3. GitHub analysing tools like [issue-wanted](https://github.com/kowainik/issue-wanted) can't just construct the path to the predefined file because the name of the repository and name of the package inside repository can be different.

So It feels that introducing a single name for all packages can make the ecosystem healthier. I'm not sure what are the benefits of forcing the `.cabal` file to have the same name as a package. But I see the benefits of having a single file name without apparent drawbacks.

### Proposed change

1. Introduce a single uniform file name (like `package.cabal` or just `.cabal`).
2. `cabal-install` should first look at the `package.cabal` file to read metadata and if this file is not present, fall back to the current scheme.

### Pros

1. Simpler integration with tooling.
2. More beginner-friendly build tooling.

### Cons

1. Slightly complicates the logic of the `cabal-install` permanently or temporary (if this change is going to be accepted and all packages will migrate to this scheme after 10 years).

### Alternatives

1. Do nothing.

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.