在开发过程中,我已经向package.yaml
添加了一个库,并且GHCi
已经启动。
例如,我添加了bytestring
库:
executables:
playground-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- playground
- text
- bytestring
因为我在名为Families.hs
的文件中使用了它,它包含以下代码:
{-# LANGUAGE TypeFamilies, OverloadedStrings #-}
module Families where
import Data.Word (Word8)
import qualified Data.ByteString as BS
当我尝试加载文件时,它抱怨:
:l ./src/Families.hs
[1 of 1] Compiling Families ( src/Families.hs, interpreted )
src/Families.hs:6:1: error:
Could not load module ‘Data.ByteString’
It is a member of the hidden package ‘bytestring-0.10.8.2’.
You can run ‘:set -package bytestring’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
|
6 | import qualified Data.ByteString as BS
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
问题是,如何将整个项目重新加载到GHCi中,并允许使用bytestring
库。
更新
我也尝试过:reload
并得到
:reload
[1 of 1] Compiling Families ( src/Families.hs, interpreted )
src/Families.hs:6:1: error:
Could not load module ‘Data.ByteString’
It is a member of the hidden package ‘bytestring-0.10.8.2’.
You can run ‘:set -package bytestring’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
|
6 | import qualified Data.ByteString as BS
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
答案 0 :(得分:0)
我看到您正在将Spacemacs与intero
一起使用。在这种情况下,您可以通过键入M-x intero-restart RET
或M-RET i r
重新启动整个内部操作过程,这将重新加载所有堆栈依赖项。
另一种方法是将光标放在错误导入上,然后键入C-c C-r
,让intero
自动解决该问题。