我認爲這將是很好的,建立我的全球GHCI配置,使我的常用導入自動發生時,提供它們的包都存在。GHCI配置文件可以使用CPP宏嗎?
我嘗試添加這~/.ghc/ghci.conf
:
:set -XCPP
#ifdef MIN_VERSION_containers
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Map (Map)
import qualified Data.Map as Map
#endif
但顯然不起作用。
> stack repl
Configuring GHCi with the following packages:
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
<interactive>:24:1: error: parse error on input ‘#’
<interactive>:29:1: error: parse error on input ‘#’
有沒有辦法讓CPP宏工作,或其他方式來實現我想要做的?
我想那個.ghci就好像你在GHCi提示符下編寫了'#ifdef ...'一樣,沒有做任何事情。 – chi