-
Notifications
You must be signed in to change notification settings - Fork 847
Description
I've discussed this in some part with various people, so I thought I'd get the thoughts down in writing. Currently, script interpreter usage of Stack has (IMO) three limitations:
-
It's slower than just using
runghcdirectly. Some of that is inherent: it needs to check for the presence of GHC and libraries, for example, whichrunghcdoes not. Nonetheless, there is more overhead than necessary. From my understanding, settings file checking is a significant component of this (and also likely something we don't want to impact the behavior of script usage). -
Scripts violate some reproducibility rules, because:
- They don't require that a
resolverbe set - They don't require that all packages be listed
- They can be impacted by other packages installed
These trade-offs all make sense when considering the
runghcfeature in general, but are less appetizing when applied to reproducible scripts. - They don't require that a
-
There are multiple options that should almost always be set but aren't enforced:
--install-ghc, a--resolveras implied above.
Proposal: let's add a new Stack command: stack script. It would have the following semantics:
- Require that a
--resolverbe set - Hide all packages from the package database except those specified with
--package. (Perhaps make an exception for wired in packages, or at the very leastbase.) - Automatically imply
--install-ghc - Ignore all settings files
As an alternative (or addition) to the above, we could consider:
- Making these behaviors options available to
runghc(e.g.,--no-parse-settings-file) - Don't actually add a
scriptcommand, but add support to the script interpreter bits of Stack to recognize ascriptcommand and do the right thing.