如何从堆栈 ghci 中删除烦人的启动消息?

How to get rid of annoying startup message from stack ghci?

我正在使用 stack ghci 启动我的 REPL,基于我为我的 得到的答案。这工作正常,但我最初收到一条警告消息 注意:未指定本地目标,因此将启动一个普通的 ghci,没有包隐藏或包选项。,然后是一堆建议关于包隐藏和选项。我的猜测是,这是因为我还没有使用 stack init 来设置项目,因为我仍处于 "playing around and learning" 状态并且还不想要项目。我还没有找到关于 'no local targets' 含义的解释,但是启动普通 ghci 的效果正是我当时想要的。有没有办法抑制这条消息?我看了 stack --help,但没找到合适的。

正如 Note(不是警告)所暗示的那样,启动了一个普通的 ghci,这在使用 stack.

时是相当罕见的情况
~$ stack ghci

Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.

      You are using snapshot: lts-14.12

      If you want to use package hiding and options, then you can try one of the following:

      * If you want to start a different project configuration than /home/username/.stack/global-project/stack.yaml, then you can use stack init to create a new stack.yaml for the packages in the
        current directory. 

      * If you want to use the project configuration at /home/username/.stack/global-project/stack.yaml, then you can add to its 'packages' field.

Configuring GHCi with the following packages: 
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/haskell-stack-ghci/2a3bbd58/ghci-script
Prelude> 

这意味着在没有 Note 的情况下获得相同行为所需要做的只是在全局堆栈环境的上下文中手动启动 ghci:

~$ stack exec -- ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Prelude> 

如果您想确保在 ghci 会话中为 "playing around and learning" 安装了一些软件包,您可以将它们作为 --package 参数提供

~$ stack exec --package massiv -- ghci
atomic-primops> using precompiled package
cabal-doctest > using precompiled package
scheduler     > using precompiled package
massiv        > using precompiled package
Completed 4 action(s).
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Prelude> import Data.Massiv.Array
Prelude Data.Massiv.Array> 

stack exec --ghci 正如 lehins 的回答对我不起作用,但 stack exec ghci 对我有用。