Reputation: 1003
I want to run a haskell code that involves networking stuff.
ghc firewall.hs
Error Message
firewall.hs:1:8:
Could not find module `Network.HTTP.Enumerator'
Use -v to see a list of the files searched for.
can anyone tell me how to install module in haskell if this problem is related to that.
Upvotes: 18
Views: 14047
Reputation: 64750
7-years later edit. Use ghcup from https://haskell.org/ghcup This can install cabal-install and GHC.
Old answer: To augment Ganesh's answer, most people I know don't bother with using the Haskell Platform but instead install GHC then using cabal-install's bootstrap script:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
export PATH=$PATH:$HOME/.ghcup/bin
Using wget (or curl, if you prefer):
wget http://hackage.haskell.org/packages/archive/cabal-install/1.18.0.1/cabal-install-1.18.0.1.tar.gz
tar xzf cabal-install-1.18.0.1.tar.gz
cd cabal-install-1.18.0.1
sh ./bootstrap.sh
export PATH=$PATH:$HOME/.cabal/bin
After that it's just a matter of using 'cabal' to install Haskell packages.
cabal update
cabal install http-enumerator
You can see this package and many others on http://hackage.haskell.org.
Upvotes: 7
Reputation: 29110
The cabal
tool handles this. In this case you need:
cabal update # to download the latest package list if not done recently
cabal install http-enumerator
If you didn't install GHC via the Haskell Platform you may not have this tool. If so, get the Haskell Platform here: http://www.haskell.org/platform/
To find out what package you need for a particular module, use the search box here: http://hackage.haskell.org/packages/archive/pkg-list.html
In some cases the answer may be ambiguous as two packages are allowed to define the same module.
Upvotes: 20