I have installed using cabal install network, HTTP, http-conduit, and http-client. When I run ghc it still throws this error:
testRun.hs:1:1: error:
Could not find module `Network.HTTP.Simple'
Perhaps you meant
Network.HTTP.Base (from HTTP-4000.3.12)
Network.HTTP.Cookie (from HTTP-4000.3.12)
Network.HTTP.Stream (from HTTP-4000.3.12)
Use -v to see a list of the files searched for.
|
1 | import Network.HTTP.Simple
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
or this error if I use Conduit:
testRun.hs:1:1: error:
Could not find module `Network.HTTP.Conduit'
Perhaps you meant Network.HTTP.Cookie (from HTTP-4000.3.12)
Use -v to see a list of the files searched for.
|
1 | import Network.HTTP.Conduit (simpleHttp)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What do in need to install?
It's using a different approach (Stack as a script interpreter), but most likely the following command will run the script with the necessary libraries available:
stack --resolver lts-12.9 script testRun.hs
Related
I could not add System.Random module to use it my source haskell file.
import System.Random
This is the error produced by stack ghc:
/Users/admin1/Haskell/PROJECTS/L4/src/Lib4.hs:32:1: error:
Could not load module ‘System.Random’
It is a member of the hidden package ‘random-1.1’.
You can run ‘:set -package random’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
32 | import System.Random
| ^^^^^^^^^^^^^^^^^^^^
Failed, five modules loaded.
Thank you very much in advance.
P.S. I am using Stack and GHC versions: Version 2.3.1, Git revision x86_64 hpack-0.33.0, ghc-8.8.3 on Mac OSX
As the error says:
It is a member of the hidden package ‘random-1.1’.
This likely means that you did not list it in the build-depends, and thus it is not exposed to your modules.
You can alter the .cabal file, and add it, for example:
-- project.cabal file
-- …
executable …
-- …
build-depends:
base >= 4.7 && < 5
, random >= 1.1
-- , …
I am trying following simple code from here :
import Data.GI.Base
import qualified GI.Gtk as Gtk
main :: IO()
main = do
Gtk.init Nothing
Gtk.main
However, I am getting following error:
Could not find module `Data.GI.Base'
Use -v to see a list of the files searched for.
|
1 | import Data.GI.Base
| ^^^^^^^^^^^^^^^^^^^
simplewin.hs:2:1: error:
Could not find module `GI.Gtk'
Use -v to see a list of the files searched for.
|
2 | import qualified GI.Gtk as Gtk
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Following attempts to install packages do not find any matches:
>cabal list Data.GI.Base
No matches found.
>cabal list GI.Gtk
No matches found.
Which packages do I install with cabal to correct above errors?
You can search Stackage (the FPComplete package repository, the de-facto standard for Haskell) for the module, type, or function name.
For example, when I type in Data.GI.Base, I get its documentation page, which tells me (at the very top) that the module is available in the package haskell-gi-base.
Not every package is available on Stackage though. If you can't find something, try Hackage next. It's less regulated and controlled, but has more stuff because of it.
I am trying to import Data.Matrix and I am getting this error:
Could not find module `Data.Matrix'
Perhaps you meant Data.Ratio (from base-4.12.0.0)
Use -v to see a list of the files searched for.
|
10 | import Data.Matrix
I don't know if I should install it or something like this and if I should do it, then how?
I'm using stack 1.6.1. In src/Main.hs I start with
module Main where
import System.IO
import System.Random
...
I do not use anything from System.Random at this time.
When I run stack ghci I get
/Users/mkaravan/end2end/Music/music/src/Main.hs:4:1: error:
Could not find module ‘System.Random’
Use -v to see a list of the files searched for.
|
4 | import System.Random
| ^^^^^^^^^^^^^^^^^^^^
I've had no luck with any of the following commands:
stack install System.Random
stack install system.random
stack install random
I get this error:
>>> stack install System.Random
Error parsing targets: Directory not found: System.Random
How do I get System.Random to run in Stack?
You probably need to add random to the dependencies section in your package.yaml (or if you are not using hpack, to build-depends in *.cabal). This tells stack that the package depends on the random package, which contains the System.Random module.
Probably the most straightforward command is stack ghci --package random. But in theory stack install random should have worked as well. However, since you haven't included the output from that call, it's not clear what didn't work with it.
Since the recent update of Haskell on my system, I'm getting numerous import errors. For example, I get:
Crypto/Enigma.hs:64:1: error:
Could not find module ‘Data.List.Split’
Use -v to see a list of the files searched for.
|
64 | import Data.List.Split (splitOn)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Crypto/Enigma.hs:70:1: error:
Could not find module ‘Data.String.Utils’
Use -v to see a list of the files searched for.
|
70 | import Data.String.Utils (replace)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is there a place I can go to see what changes have been made to the package structure in the recent update? Im particular, where the functions I'm looking for have gone (to what modules)?