I have a file
#!/usr/bin/env stack
{- stack script --resolver ... --package ... -}
and running ./Script.hs or stack Script.hs works as expected. But I would like to have a CI job checking that Script.hs builds (but not runs). I do see stack script has a --no-run flag, but it seems like I would have to copy the entire stack script command to do so:
stack script --compile --no-run Script.hs --resolver ... --package ...
Doing stack Script.hs --no-run or stack script Script.hs --no-run would fail; the first would pass --no-run as an argument to Script.hs, and the second would fail with "script requires --resolver".
The most straightforward way I see here is to add a STACK_INTERPRETER_NO_RUN=true env var that will add the --no-run flag to stack script and the appropriate flags to stack runghc.
I have a file
and running
./Script.hsorstack Script.hsworks as expected. But I would like to have a CI job checking thatScript.hsbuilds (but not runs). I do seestack scripthas a--no-runflag, but it seems like I would have to copy the entirestack scriptcommand to do so:Doing
stack Script.hs --no-runorstack script Script.hs --no-runwould fail; the first would pass--no-runas an argument toScript.hs, and the second would fail with "scriptrequires--resolver".The most straightforward way I see here is to add a
STACK_INTERPRETER_NO_RUN=trueenv var that will add the--no-runflag tostack scriptand the appropriate flags tostack runghc.