During the development, I've added a library to package.yaml
and the GHCi
is already started.
For example, I've added the bytestring
library:
executables:
playground-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- playground
- text
- bytestring
Because I use it in a file that is called Families.hs
and it contains the following code:
{-# LANGUAGE TypeFamilies, OverloadedStrings #-}
module Families where
import Data.Word (Word8)
import qualified Data.ByteString as BS
When I try to load the file, it complains:
: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.
The question is, how to reload the whole project into the GHCi and allow usage of bytestring
library.
UPDATE
I also tried with :reload
and got
: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.