如何在不编译和链接整个项目的情况下加载 `stack ghci`?

How to load `stack ghci` without compiling & linking the whole project?

当仅要求 stack ghci 时,是否为其他人 stack 编译并 link 整个项目?

它不应该跳过前者并立即跳转到 ghci 以加载源吗?我观察到它在我的大部分项目中都为我完成了这两项工作,因此它似乎在做一些多余的工作。这是设计使然,还是我错误配置了一些堆栈项目?

也许这是 cabal 在下面没有 stack 要求的情况下完成的?

无论如何,当我只想输入 stack ghci 时,我可以做些什么来跳过编译 + linking 吗?

来自Haskell Tool Stack Documentation

Speeding up initial load

There are two ways to speed up the initial startup of ghci:

  • --no-build, to skip an initial build step. This only works if the dependencies have already been built.

您还可以 stack ghci 跳过加载源(如果您知道您只想加载一个文件,并且可以手动完成),方法是:

  • --no-load, to skip loading all defined modules into ghci. You can then directly use :load MyModule to load a specific module in your project.

我刚刚意识到 -fobject-code 也可能参与其中。我不确定它在哪里设置(不在命令行上,不在 .cabal/package.yaml 文件中,也不在 ~/.ghci 中)。

然而,当我用 --ghci-options=-fbyte-code 否定它时,重新编译似乎并没有发生。

我仍然希望听到其他人的回应,因为我想更彻底地理解为什么 -fobject-code 可能需要几分钟才能在初始加载时完全重新编译,因为 :reloading 只需要大约文件更改后的第二个。 (例如 ghcid 也是。)