Cabal - add build dependency with Cabal instead of manually mangling with the file

Viewed 893

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?

1 Answers

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.

Related