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

Difference in behavior between `stack script` and `stack script --compile` #3377

mgsloan opened this Issue Aug 22, 2017 · 0 comments


None yet
1 participant
Copy link

mgsloan commented Aug 22, 2017

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.

@mgsloan mgsloan added this to the P2: Should milestone Aug 22, 2017

mgsloan added a commit that referenced this issue Jan 25, 2019

mgsloan added a commit that referenced this issue Jan 25, 2019

mihaimaruseac added a commit that referenced this issue Jan 26, 2019

Merge pull request #4538 from commercialhaskell/stack-script-import-s…

Have "stack script" set import search path #3377
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment