将 -ddump-splices 传递给 Stack 脚本解释器

Passing -ddump-splices to Stack script interpreter

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

#!/usr/bin/env stack
{- stack
     --resolver lts-9.0
     --install-ghc
     runghc
     --package yesod
     --package yesod-core
-}


{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes       #-}
{-# LANGUAGE TemplateHaskell   #-}
-- and the code goes on

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

是的,您必须在传递实际的 ghc 选项之前使用 --。即:

#!/usr/bin/env stack
{- stack
     --resolver lts-9.0
     --install-ghc
     runghc
     --package yesod
     --package yesod-core
     -- -ddump-splices
-}

您可以使用 ghc --show-options 查看您可以传递的选项类型。有关详细信息,请参阅此处:https://github.com/commercialhaskell/stack/issues/650#issuecomment-123470879