如何摆脱堆栈ghci中令人讨厌的启动消息?

问题描述 投票:4回答:1

根据我对stack ghci的回答,我正在使用question on how to import a module installed with stack启动我的REPL。这可以正常工作,但是我最初会收到一条警告消息注意:未指定本地目标,因此将在没有包隐藏或包选项的情况下启动纯ghci。,然后是有关包隐藏和选项的大量建议。我的猜测是,这是因为我还没有使用stack来设置项目,因为我仍处于“玩耍和学习”状态,并且还不需要项目。我还没有找到关于“没有本地目标”的含义的解释,但是启动纯ghci的效果恰恰是我当时想要的。有没有办法抑制此消息?我查看了stack init,但找不到合适的内容。

haskell haskell-stack
1个回答
1
投票

正如stack --help(不是警告)所建议的那样,将启动普通的ghci,这在使用Note时很少见。

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> ,要获得相同的行为,您需要做的所有事情就是在全局堆栈环境中手动启动ghci:

Note

如果要确保在ghci会话中安装了一些用于“玩耍和学习”的软件包,可以将其作为~$ stack exec -- ghci GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help Prelude> 参数提供

--package
© www.soinside.com 2019 - 2024. All rights reserved.