-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interpreter: Don't make cached packages available that are not specified with --package
#1208
Comments
--package
There's a tension between making scripting as convenient as possible for "one-offs" and making them reproducible. My inclination is to lean toward the "one-off" case for this, and recommend making an actual project if you want proper reproducibility. I already find the If we do want proper reproducible scripts, I think we'd have to considering adding support for an inline |
I didn't really consider the use-case of one-off scripts, but that's a very good point. Ideally I think we would have both: reproducible and one-off scripts. (This could be done with a command line switch or a separate command.) Any thoughts on this? |
No objection to finding a way to optionally improve reproducibility for scripts. Simplest might be be to add a switch to |
Note discussion of multiline script directive in #1394, which should probably be done before this. Also, related discussion about adding a |
In the meantime, is there any better way to test whether your script has undeclared dependencies rather than having to manually create a Personally, I've never wanted irreproducible scripts because I hop around machines and LTS versions so much that I don't mentally have any model whatsoever of the state of my cache on a given machine. I also wanted to throw out there that there are other reasons to use the script interpreter rather than a full
|
Always pass all the explicitly specified packages in the script to ghc command line. Also allow ghc options to be specified from the interpreter command. This will give user the flixibility to, for example, use '-hide-all-packages' ghc option. Like this: {- stack runghc --package base --package exceptions --package transformers --package containers --package getopt-generics --package filepath --package path --package path-io --package process --package unix-compat -- -hide-all-packages -} fixes #1208
I provided a fix in PR #2480 . The PR provides a way to pass ghc options from interpreter command which was not possible before. It passes all specified packages explicitly on ghc command line and allows you to pass A syntactic sugar in the form of a runghc option can also be provided. Though it will not be any shorter compared to passing |
You don't have to justify this :-) Haskell is a great scripting language and we should make scripting a first class feature. Maybe we can replace python with Haskell one day. |
Always pass all the explicitly specified packages in the script to ghc command line. Also allow ghc options to be specified from the interpreter command. This will give user the flixibility to, for example, use '-hide-all-packages' ghc option. Like this: {- stack runghc --package base --package exceptions --package transformers --package containers --package getopt-generics --package filepath --package path --package path-io --package process --package unix-compat -- -hide-all-packages -} fixes #1208
Consider the following script:
This script depends on the package
safe
. It currently works without problems on my machine, but only because I already have the packagesafe
cached for the specified snapshot. On machines where the package is not installed it fails withIt would be great if
stack
scripts would either fail or succeed independent of cache state. Then I could createstack
scripts on my machine, copy them to different machines and be fairly sure that they will run.The text was updated successfully, but these errors were encountered: