Passing ghc-options to Stack script interpreter

Viewed 92

I'm using Stack interpreter feature and having a code like this:

#!/usr/bin/env stack 
-- stack script --resolver lts-12.7 --package yesod 

main = print "hello"

I want to pass the ghc-options option to the stack interpreter to it. Is it possible ?

1 Answers

Recent version of Stack supports ghc-options directly:

#!/usr/bin/env stack 
-- stack script --resolver lts-12.7 --package yesod --ghc-options -Wall

main = print "hello"

And on executing:

$ stack jest.hs

/home/sibi/github/subsite/jest.hs:4:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: main :: IO ()
  |
4 | main = print "hello"
  | ^^^^
"hello"
Related