You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> hpack
WARNING: package.yaml: Ignoring unrecognized field $.library.build-depends
WARNING: package.yaml: Ignoring unrecognized field $.library foo
generated pkgA.cabal
-- generated pkgA.cabalcabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.6.---- see: https://github.com/sol/hpackname: pkgA
version: 0.0.0build-type: Simple
libraryother-modules:
Paths_pkgA
default-language: Haskell2010
I think this could work the same way that executables do. (See #161 for some commentary about that.) We could introduce a new top level libraries key that allows them to be named. Then we could make library: ... a shortcut for libraries: { PACKAGE_NAME: ... }.
Yesterday, I pushed a change that allows to have aliases for fields: 92c6c94
Optionally, aliases can be deprecated.
This facilitates renaming in a backwards compatible way.
I would still want to see a working, fully self-contained example before deciding to do that.
Instead of renaming, we may also decide to add a new libraries field that sets visibility: public by default + deprecate internal-libraries. I think this would be more appropriate if public libraries are the common case, not sure.
As a side note, Cabal having both exposed / visibility is not a great user interface.
Thanks for picking this up @sol. I went looking for libraries but somehow missed internal-libraries.
This alias work is amazing. I have an hpack dependency. Others have a cabal build-dependency. With this we might bridge the gap.
Could aliasing eventually cover all fields so that we might use hpack with a phrasing matching cabal's?
On 92c6c94, aliases seem second class when I see a test "gives the primary name precedence". Could we give this more of a "warns on duplicate fields" feel?
@brandon-leapyear's observation above caught me out. I had a package description for an executable that depended on the main library and two named libraries:
Activity
tfausak commentedon Mar 10, 2022
I think this could work the same way that executables do. (See #161 for some commentary about that.) We could introduce a new top level
librarieskey that allows them to be named. Then we could makelibrary: ...a shortcut forlibraries: { PACKAGE_NAME: ... }.Change field to packageLibraries, sol#483.
Render library with empty name, sol#483.
Add package library to libraries, sol#483.
Rename to libraries in expectations, sol#483.
philderbeast commentedon Mar 16, 2022
There is already
internal-librariesand these can havevisibility: public, see #382.philderbeast commentedon Mar 16, 2022
Should we rename these to
libraries? Withvisibility: publicthey're not that internal anymore.sol commentedon Apr 23, 2022
Yesterday, I pushed a change that allows to have aliases for fields: 92c6c94
Optionally, aliases can be deprecated.
This facilitates renaming in a backwards compatible way.
I would still want to see a working, fully self-contained example before deciding to do that.
Instead of renaming, we may also decide to add a new
librariesfield that setsvisibility: publicby default + deprecateinternal-libraries. I think this would be more appropriate if public libraries are the common case, not sure.As a side note, Cabal having both
exposed/visibilityis not a great user interface.philderbeast commentedon Apr 23, 2022
Thanks for picking this up @sol. I went looking for
librariesbut somehow missedinternal-libraries.This alias work is amazing. I have an hpack dependency. Others have a cabal build-dependency. With this we might bridge the gap.
Could aliasing eventually cover all fields so that we might use hpack with a phrasing matching cabal's?
On 92c6c94, aliases seem second class when I see a test "gives the primary name precedence". Could we give this more of a "warns on duplicate fields" feel?
brandon-leapyear commentedon Dec 20, 2022
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
Another issue I found: you can explicitly depend on the main library by using the package name as a sublibrary name, which allows you to do:
mylib:{mylib, internallib}But hpack seems to strip it out:
https://fgaz.me/posts/2019-11-14-cabal-multiple-libraries/
mpilgrem commentedon May 4, 2026
@brandon-leapyear's observation above caught me out. I had a package description for an executable that depended on the main library and two named libraries:
and the resulting Cabal file (extract below) means the package cannot be built:
Re #483 Accept main lib in shorthand syntax for dependencies
Re #483 Accept main lib in shorthand syntax for dependencies
Re #483 Accept main lib in shorthand syntax for dependencies