I'm fairly new to Haskell, and upon seeing this flag, e.g. in this dockerfile, I can't ever seem to find an explanation for what it does. "Install only the dependencies necessary to build the given packages," in the cabal help install doesn't say much to me.
If I'm not building inside a docker container, I use sandboxes. Is this flag applicable to either of these situations?
For cabal, what does only-dependencies flag mean?
It can be spelled as both --dependencies-only and --only-dependencies and it simply means that it will install all, and only, the dependencies the specific package requires (without installing or building the packages themselves). Note that by default tests and benchmark dependencies will not be installed; for them you need to add --enable-tests and --enable-benchmarks respectively.
Is this flag applicable to either of these situations?
Yes, this can be used just fine with cabal sandboxes as well as without.
What's then the difference between it and simply running cabal install, which has worked for me so far?
cabal install will install both those dependencies and the packages themselves. Same for cabal build. cabal install --only-dependencies will only install the dependencies those packages require.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With