commercialhaskell / commercialhaskell/stack
Difference in behavior between `stack script` and `stack script --compile`
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
When looking into https://github.com/commercialhaskell/stack/issues/3372 , I noticed a difference in behavior between `stack script` and `stack script --compile`:
* `stack script` uses `runghc`, run in the current directory.
* `stack script --compile` uses `ghc` run in the directory of the source file, and then runs the result in the current directory.
It certainly makes sense to run the code in the current directory, this allows these scripts to be used as commandline tools. However, this means that `ghc` itself is run in different places depending on the option. This at least affects:
* Importing modules
* Use of reading relative paths from TH
Importing modules could be supported by using `-i`, but this does not solve the TH problem. I believe a solution there would require using something other than `runghc`.
Contributor guide
Assessment
This issue has not been assessed yet.