When looking into #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.