Reputation: 5147
Do I need to manually edit the *.cabal file's build-depends
section to add package as a project dependency?
Or perhaps there is a more convenient way that is not as error prone as manually mangling with build files is.
Thinking about functionality that pretty much any package manager I used has, namely
apt install
npm i
nuget install
Install Package
and so on. Does such functionality exist in Cabal?
Upvotes: 8
Views: 3535
Reputation: 2775
There is a subcommand cabal gen-bounds
which is a bit more convenient but not such enough.
Just declare your dependencies without version tag in .cabal
file. And then run cabal gen-bounds
and manually copy the output into the .cabal
.
Upvotes: 1
Reputation: 38893
There is no better way at the moment. The answer @danidiaz gave is essentially correct -- cabal-edit
will automatically update cabal files for you. The plan is to import similar functionality into cabal directly. This was remains blocked on an exactprinter that can parse and emit cabal files precisely -- and work on that exactprinter is now underway.
Upvotes: 4