-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are many public libraries allowed or not? #9480
Comments
We can have multiple public libraries, plugins-with-blobs.cabal is an example. |
There's an overhaul of that part of the documentation in git, fixing the inconsistency among other things. I suspect your problem stems from how you have to refer to such libraries, although I don't recall how you do it correctly off the top of my head. |
Here's a snippet of referencing public libraries as build-depends:
base >=4.9.1.0 && <5
, plugins-for-blobs:thoralf-encode
, plugins-for-blobs:thoralf-plugin
, plugins-for-blobs:thoralf-plugin-uom
, plugins-for-blobs:thoralf-theory
, plugins-for-blobs:uom-quantity
, plugins-for-blobs:uom-th
, template-haskell >=2.9 The thoralf-uom.cabal package does the same thing but with dependencies from other packages: build-depends:
base >=4.9.1.0 && <5
, template-haskell >=2.9
, thoralf-uom:thoralf-plugin-uom
, thoralf:thoralf-encode
, thoralf:thoralf-plugin
, thoralf:thoralf-theory
, uom:uom-quantity
, uom:uom-th |
OP refers to the stable version of the docs. Can someone confirm with the latest version? (There's a switch between the versions on the website) Examples may be worth adding to the manual. |
I can confirm the problem was syntax. The way to depend on it is cabal-version: 3.8
name: french-deck -- or libA if prefered
...
library -- the regular main library
hs-source-dirs: src
exposed-modules: X, Y
library french-deck-quickcheck -- or libB with Orphan instances
...
build-depends:
base >=4.16.4.0 && < 5,
french-deck -- depends on libA
visibility: public
hs-source-dirs: src/quickcheck -- This must not!! be just src. It throws an parse error (why?) when building french-deck
exposed-modules: Z
test-suite my-tests
build-depends:
base >=4.16.4.0 && < 5,
french-deck,
french-deck:french-deck-quickcheck
hs-source-dirs: test |
In my opinion:
I can create a PR with the small modifications in the docs about it but I can't find where the docs are in the repo. |
A good plan! Are the docs you have in mind at https://github.com/haskell/cabal/tree/master/doc perchance? |
I see @chreekat and @ffaf1 have already commited (#9371 and #8982) many changes with this regards, but those aren't part of the docs yet. Is there any time-bounded release cycle for docs? I see the section
One question: the term sublibrary seems to be the official one now. Is it reseve only for private libraries or public libraries are also named "sub"? |
FYI, the newest docs, from the not yet released version of cabal, are at https://cabal.readthedocs.io/en/latest/ |
There was a long discussion in a ticket or at discord and I remember all libraries but the main one are "sub" now, both private and public. |
What is wrong with the docs?
In section library is very clearly claimed:
Whereas in the visibility section, a contradiction arises:
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 isI got the error below.
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 inlibA
(which I wouldn't like)The text was updated successfully, but these errors were encountered: