6

The commands install, v1-install, v2-install and new-install are simply described to "Install packages" when running man cabal. Are they different from one another? Which is the preferred option?

Jan Berndt
  • 913
  • 1
  • 10
  • 22

1 Answers1

7

For modern versions of cabal-install, install, new-install and v2-install are the same. v1-install and the other v1- commands are obsolete and should not be used anymore.

Notice that, when developing a cabal package, the install command is largely unnecessary. Running cabal build and cabal repl will automatically install the required dependencies (listed in the build-depends: section of the cabal file).

cabal install is still useful in cases like the following:

  • Installing an executable from a package. Like the warp executable from the package wai-app-static. In those cases, the options --overwrite-policy, --install-method and --installdir are useful.
  • Creating a local package environment in some folder, so that "bare" invocations of ghc and ghci see some desired set of libraries. Like this. In those cases, the options --lib and --package-env are useful.
danidiaz
  • 26,936
  • 4
  • 45
  • 95
  • 1
    The fact that completely different sets of options are relevant for different cases suggests that the command should be split into two: one for installing executables, and another for creating package environments. – danidiaz Mar 08 '21 at 19:36