Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cabal: how to automatically update the build-depends field in the .cabal file?

Tags:

Is there a way to automatically update the build-depends field in the .cabal-file? For example, if we start with the following .cabal file:

name:           HUnit
version:        1.1.1
synopsis:       A unit testing framework for Haskell
homepage:       http://hunit.sourceforge.net/
category:       Testing
author:         Dean Herington
license:        BSD3
license-file:   LICENSE
cabal-version:  >= 1.10
build-type:     Simple

library
  build-depends:      base >= 2 && < 4
  exposed-modules:    Test.HUnit.Base, Test.HUnit.Lang,
                      Test.HUnit.Terminal, Test.HUnit.Text, Test.HUnit
  default-extensions: CPP

Then, install a package:

cabal install warp

Now, I have to add warp >=3.0 && <3.1 to the build-depends field, to make the file look like this:

name:           HUnit
version:        1.1.1
synopsis:       A unit testing framework for Haskell
homepage:       http://hunit.sourceforge.net/
category:       Testing
author:         Dean Herington
license:        BSD3
license-file:   LICENSE
cabal-version:  >= 1.10
build-type:     Simple

library
  build-depends:      base >= 2 && < 4, warp >=3.0 && <3.1
  exposed-modules:    Test.HUnit.Base, Test.HUnit.Lang,
                      Test.HUnit.Terminal, Test.HUnit.Text, Test.HUnit
  default-extensions: CPP

My question is: how do we update this file automatically?

like image 868
Marcus Vinícius Monteiro Avatar asked May 14 '15 23:05

Marcus Vinícius Monteiro


1 Answers

There are two tools in modern cabal-install for aiding with managing bounds of dependencies. First is gen-bounds which suggests proper version-ranges for packages based on the specifications of versions currently installed. The second is outdated, which lists dependencies in the cabal file for which newer versions exist on hackage. Both are documented in the cabal manual: https://www.haskell.org/cabal/users-guide/developing-packages.html#generating-dependency-version-bounds

like image 79
sclv Avatar answered Sep 24 '22 02:09

sclv