Как перезагрузить проект после добавления зависимостей?
Во время разработки я добавил библиотеку 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.
1 ответ
Я вижу, что вы используете Spacemacs вместе с intero
, В этом случае вы можете перезапустить весь процесс интеро, набрав M-x intero-restart RET
, или же M-RET i r
который перезагрузит все зависимости стека.
Другой способ сделать это - навести курсор на ошибку импорта и ввести C-c C-r
чтобы позволить intero
автоматически исправить проблему.