Are many public libraries allowed or not?
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**What is wrong with the docs?**
In section [library](https://cabal.readthedocs.io/en/stable/cabal-package.html#pkg-section-library-library) is very clearly claimed:
> Currently, there can only be one publicly exposed library in a package, and its name is the same as package name set by global name field.
Whereas in the [visibility](https://cabal.readthedocs.io/en/stable/cabal-package.html#pkg-field-library-visibility) section, a contradiction arises:
> Can be public or private. Makes it possible to have multiple public libraries in a single package
**Additional context**
In my personal project I am trying to build two libraries within the same package. The main regular library (`libA`) and then a library with orphan quickcheck instances (`libB`). Test suite depends on both. So the cabal file is
```cabal
cabal-version: 3.8
name: french-deck -- or libA if prefered
...
library -- the regular main library
...
library french-deck-quickcheck -- or libB with Orphan instances
...
build-depends:
base >=4.16.4.0 && < 5,
french-deck -- depends on libA
visibility: public -- public because I want to import these instances in other package
test-suite my-tests
build-depends:
base >=4.16.4.0 && < 5,
french-deck,
french-deck-quickcheck
```
I got the error below.
```
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: french-deck-0.1.0.0 (user goal)
[__1] trying: french-deck:*test
[__2] unknown package: french-deck-quickcheck (dependency of french-deck
*test)
[__2] fail (backjumping, conflict set: french-deck, french-deck-quickcheck,
french-deck:test)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: french-deck, french-deck:test,
french-deck-quickcheck
```
I am using `cabal-install-3.8.1.0`. At this point I don't know if multiple libraries are allowed or not and I have to define my instances in `libA` (which I wouldn't like)
Contributor guide
Assessment
This issue has not been assessed yet.