在开发过程中,我添加了一个库,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.