install、v1-install、v2-install 和 new-install 之间有什么区别?

What is the difference between install, v1-install, v2-install and new-install?

installv1-installv2-installnew-install 命令在 运行 man cabal 时被简单地描述为“安装包”。它们彼此不同吗?哪个是首选?

对于modern versions of cabal-install, install, new-install and v2-install是一样的。 v1-install 和其他 v1- 命令已过时,不应再使用。

请注意,在开发 cabal 包时,install 命令在很大程度上是不必要的。 运行 cabal build and cabal repl will automatically install the required dependencies (listed in the build-depends: section of the cabal file).

cabal install 在以下情况下仍然有用:

  • 正在从包中安装可执行文件。就像包 wai-app-static 中的 warp 可执行文件一样。在这些情况下,选项 --overwrite-policy--install-method--installdir 很有用。
  • 正在创建本地 package environment in some folder, so that "bare" invocations of ghc and ghci see some desired set of libraries. Like 。在这些情况下,选项 --lib--package-env 很有用。