moocfi/haskell-mooc

Set14b.hs does not load in GHCI

Closed this issue · 2 comments

To reproduce:

  • install haskell:
sudo apt install -y build-essential curl libffi-dev libffi8ubuntu1 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 zlib1g-dev &&
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=latest BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh
ghci> :load Set14b.hs 
[1 of 2] Compiling Mooc.Todo        ( Mooc/Todo.hs, interpreted )
[2 of 2] Compiling Set14b           ( Set14b.hs, interpreted )

Set14b.hs:24:1: error:
    Could not find module ‘Network.Wai’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
24 | import Network.Wai (pathInfo, responseLBS, Application)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Set14b.hs:25:1: error:
    Could not find module ‘Network.Wai.Handler.Warp’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
25 | import Network.Wai.Handler.Warp (run)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Set14b.hs:26:1: error:
    Could not find module ‘Network.HTTP.Types’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
26 | import Network.HTTP.Types (status200)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Set14b.hs:29:1: error:
    Could not find module ‘Database.SQLite.Simple’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
29 | import Database.SQLite.Simple (open,execute,execute_,query,query_,Connection,Query(..))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, one module loaded.

You need to use stack ghci so that the packages installed by stack are visible. Does that help?

Yes, this fixed it, thank you. I thought I'd just used ghci for testing every file up to Set14.