使用堆栈时编辑“.ghci”文件

Editing the ".ghci" file when using stack

我已经开始使用 Stack,但找不到要编辑的 .ghci 文件(我希望包括 :set -XOverloadedStrings:set prompt "ghci> ")。

搜索我使用的.ghci文件-

$ find -name ".ghci"
$

这 return 没有任何搜索结果。我查看了 Stack 文档,但找不到有关编辑 .ghci 文件的信息。是否可以在某处保存 :set -XOverloadedStrings:set prompt "ghci> "

它应该在 $HOME/.ghc/ghci.conf$HOME/.ghci 中。如果两者都不存在,您可以自己创建...

详情如下:GHC User Guide - The .ghci and .haskeline files

When it starts, unless the -ignore-dot-ghci flag is given, GHCi reads and executes commands from the following files, in this order, if they exist:

  1. ./.ghci
  2. appdata/ghc/ghci.conf, where ⟨appdata⟩ depends on your system, but is usually something like C:/Documents and Settings/user/Application Data
  3. On Unix: $HOME/.ghc/ghci.conf
  4. $HOME/.ghci

The ghci.conf file is most useful for turning on favourite options (e.g. :set +s), and defining useful macros.