代码之家  ›  专栏  ›  技术社区  ›  Sibi

将ghc选项传递给堆栈脚本解释器

  •  3
  • Sibi  · 技术社区  · 8 年前

    我正在使用堆栈解释器特性,并有一个这样的代码:

    #!/usr/bin/env stack 
    -- stack script --resolver lts-12.7 --package yesod 
    
    main = print "hello"
    

    我想通过 ghc-options 堆栈解释器的选项。有可能吗?

    1 回复  |  直到 8 年前
        1
  •  5
  •   Sibi    8 年前

    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"
    
    推荐文章