对于 cabal,only-dependencies 标志是什么意思?

For cabal, what does only-dependencies flag mean?

我是 Haskell 的新手,看到这个标志后,例如在这个 dockerfile 中,我似乎永远找不到对它的作用的解释。 "Install only the dependencies necessary to build the given packages,"中的cabal help install对我来说没什么意义。

如果我不在 docker 容器内构建,我会使用沙箱。这个标志适用于这两种情况吗?

For cabal, what does only-dependencies flag mean?

它可以拼写为 --dependencies-only--only-dependencies,它只是意味着它将安装所有且仅安装特定包所需的依赖项(无需安装或构建包本身) .请注意,默认情况下不会安装测试和基准依赖项;对于它们,您需要分别添加 --enable-tests--enable-benchmarks

Is this flag applicable to either of these situations?

是的,无论有没有 cabal 沙箱,这都可以很好地使用。

What's then the difference between it and simply running cabal install, which has worked for me so far?

cabal install 将同时安装这些依赖项和软件包本身。 cabal build 也一样。 cabal install --only-dependencies 将只安装那些包需要的依赖项。