GHCI 的 :add 命令可以接受相对于主目录的路径吗?

Can GHCI's :add command accept a path that is relative to one's home directory?

这是 :add 的 GHC 手册文档:

:add[*] ⟨module⟩

Add ⟨module⟩(s) to the current target set, and perform a reload. Normally pre-compiled code for the module will be loaded if available, or otherwise the module will be compiled to byte-code. Using the * prefix forces the module to be loaded as byte-code.

我可以从实验中看出 ⟨module⟩ 实际上不一定是模块的名称;它也可以是文件路径。如果它不是绝对路径,它似乎是相对于启动 REPL 的当前目录来解析的。

是否可以引用 :add 相对于主目录的路径?

例如,我想从我的全局 GHCI 配置中包含 $HOME/.ghci/imports.hs。 (有关其背后的动机,请参阅 Can a GHCI config file use CPP macros?

我试过明显的方法

:add $HOME/.ghc/imports.hs

但它不起作用:

<no location info>: error: can't find file: $HOME/.ghc/imports.hs
Failed, modules loaded: none.

使用 ~ 代替 $HOME

λ :add ~/Documents/Code/Haskell/Ackermann
[1 of 1] Compiling Ackermann        ( /Users/rampion/Documents/Code/Haskell/Ackermann.hs, interpreted )
Ok, modules loaded: Ackermann.