@@ -4,9 +4,9 @@ Package Description
4
4
The Cabal package is the unit of distribution. When installed, its
5
5
purpose is to make available:
6
6
7
- - One or more Haskell programs.
7
+ - One or more Haskell programs (executables) .
8
8
9
- - At most one library , exposing a number of Haskell modules.
9
+ - One or more libraries , exposing a number of Haskell modules.
10
10
11
11
However having both a library and executables in a package does not work
12
12
very well; if the executables depend on the library, they must
@@ -801,15 +801,16 @@ Library
801
801
802
802
Build information for libraries.
803
803
804
- Currently, there can only be one publicly exposed library in a
805
- package, and its name is the same as package name set by global
806
- :pkg-field: `name ` field. In this case, the ``name `` argument to
807
- the :pkg-section: `library ` section must be omitted.
804
+ A package can have one default library, which is identified by omitting the
805
+ ``name `` argument.
808
806
809
- Starting with Cabal 2.0, private internal sub-library components
810
- can be defined by setting the ``name `` field to a name
811
- different from the current package's name; see section on
812
- :ref: `Internal Libraries <sublibs >` for more information.
807
+ Starting with Cabal 2.0, sub-library components can be defined by setting
808
+ the ``name `` field to a name different from the current package's name; see
809
+ section on :ref: `Internal Libraries <sublibs >` for more information. By
810
+ default, these sub-libraries are private and internal. Since Cabal 3.0,
811
+ these sub-libraries can also be exposed and used by other packages. See the
812
+ :pkg-field: `library:visibility ` field and :ref: `Multiple Public Libraries
813
+ <publicsublibs>` for more information.
813
814
814
815
The library section should contain the following fields:
815
816
@@ -1005,7 +1006,9 @@ a real-world use case:
1005
1006
specify an internal library in a ``build-depends: `` section is
1006
1007
``package-name:internal-library-name ``.
1007
1008
1008
- **Multiple public libraries **
1009
+ .. _publicsublibs :
1010
+
1011
+ **Multiple Public Libraries **
1009
1012
1010
1013
Cabal 3.0 and later support exposing multiple libraries from a single package
1011
1014
through the field :pkg-field: `library:visibility `.
@@ -1629,7 +1632,7 @@ system-dependent values for these fields.
1629
1632
Multiple libraries from the same package can be specified with the shorthand
1630
1633
syntax ``pkg:{lib1,lib2}` ``.
1631
1634
1632
- See section on :ref: `Internal Libraries <sublibs >` for examples and more
1635
+ See section on :ref: `Multiple Public Libraries <publicsublibs >` for examples and more
1633
1636
information.
1634
1637
1635
1638
**Version Constraints **
0 commit comments