commercialhaskell / commercialhaskell/stack
`stack script --compile` crashes
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary/comments (optional)
I created a haskell script with a hashbang invoking `stack script --compile`. Running the script crashes.
### Steps to reproduce
I created a file `foo` with the following content:
``` haskell
#!/usr/bin/env stack
{-
stack script
--resolver lts-18.16
--compile
-}
main = return ()
```
I made the file executable (`chmod +x foo`) and then ran it with `./foo`.
### Expected
I expected that `stack` would execute my haskell program. (Which would mean not printing out anything and exiting successfully.)
Note that if I remove `--compile` from the file, it works as I expect it to. I would expect `stack script --compile` to behave exactly like `stack script` only slower on the first run and faster on subsequent runs.
### Actual
I get the following error:
```
target ‘/home/shahn/foo’ is not a module name or a source file
Received ExitFailure 1 when running
Raw command: /home/shahn/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/bin/ghc-8.10.7 -i -i/home/shahn/ -hide-all-packages -fdiagnostics-color=always -packagebase /home/shahn/foo
Run from: /home/shahn/
```
### Stack version
```
$ stack --version
Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4
```
### Method of installation
`stack upgrade`
Contributor guide
Assessment
This issue has not been assessed yet.