将 ghc-options 传递给 Stack 脚本解释器

Passing ghc-options to Stack script interpreter

我正在使用 Stack 解释器功能并且有这样的代码:

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

main = print "hello"

我想将 ghc-options 选项传递给堆栈解释器。可能吗?

最近版本的Stack直接支持ghc-options

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

main = print "hello"

并在执行时:

$ 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"