Does `stack build --fast` affect `--only-dependencies`?

I’m trying to maximize sharing of build artifacts in CI. I use stack build --fast for CI, so it will finish building faster; and stack build (no --fast) when building releases, so the final executable will execute faster.

I’m wondering whether stack build --fast --only-dependencies is any different from stack build --only-dependencies (no --fast). If they are the same, then I can share the results across both CI and Release builds; if they aren’t the same, I will continue not sharing the results across the two build types.

I noticed that the dependencies aren’t rebuilt when I add or remove --fast the way local I thought local packages do, which makes me think (and hope, for correctness) that --fast simply doesn’t affect dependency packages that are built into ~/.stack. (Maybe I’m wrong about this? Today adding or removing --fast doesn’t trigger a rebuild of local packages.)

Does anyone know or is anyone able to point to a definitive answer?

Many thanks!


Correct, --fast only applies to your local packages.

PS since I’ve just been fixing up workflows - the ones at show my caching attempts. Best-case runs take a couple of minutes.


If you have not set Stack’s apply-ghc-options configuration option to everything, then GHC options set at the command line are applied only to project packages. The --fast flag sets the GHC option -O0 at the command line.