I'm trying this simple example:
module Main where
import Network.HTTP
import Lib
get :: String -> IO String
get url = simpleHTTP (getRequest url) >>= getResponseBody
-- 2. Get the response code
getCode :: String -> IO ResponseCode
getCode url = simpleHTTP req >>= getResponseCode
where req = getRequest url
main :: IO ()
main = do
x <- get "http://google.com"
putStrLn x
I get
/workspaces/hask_exercises/api-exercises/app/Main.hs:2:1: error:
Could not find module `Network.HTTP'
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
2 | import Network.HTTP
| ^^^^^^^^^^^^^^^^^^^
I tried from here: Haskell: Could not find module ‘Network.HTTP’
cabal install --lib network
cabal: The program 'ghc' version >=7.0.1 is required but it could not be
found.
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.4
sh -c "curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh"andstack runstack- maybe you didstack setup? If it'll not install GHC in your path - and in this case you should usestackto install your dependencies too