Closed
Description
General
Using Stack as a script interpreter doesn't accept RTS options as noted in the Stack documentation.
I'm not sure if there's a bug with Stack or an error in the documentation.
Steps to reproduce
- Put the following in a file:
- The top section is copied and pasted from the Stack documentation.
#!/usr/bin/env stack {- stack script --resolver lts-6.25 --package turtle -- +RTS -s -RTS -} main :: IO main = putStrLn "Hello, world!"
- Make the file executable
$ chmod +x <file>
- Execute the file
$ ./<file>
Expected
The script should print Hello, world!
.
Actual
The script errors out with the following:
target ‘+RTS’ is not a module name or a source file
Output
$ stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
$ cat ./StackScriptTest.hs
#!/usr/bin/env stack
{- stack
script
--resolver lts-6.25
--package turtle
--
+RTS -s -RTS
-}
main :: IO
main = putStrLn "Hello, world!"
$ ./StackScriptTest.hs
target ‘/home/dacali/projects/onefile/+RTS’ is not a module name or a source file
Stack version
$ stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
Method of installation
- Upgraded with
stack upgrade