When I tried to load a .hs in ghci, it failed on the line:
import System.Random
Message:
Could not find module `System.Random'
Use -v to see a list of the files searched for.
I remember it worked yesterday and all of a sudden today it does not work. This problem only occurs on Ubuntu 12.04 LTS, GHCi 7.4.1 , when i tried this on windows haskell platform and other linux machines i worked.
I tried to use
sudo apt-get remove ghc
sudo apt-get install ghc
to remove and re install ghc, but however the problem persists.
Could someone help me? Thanks
You must install the random package. You can probably get it from your package manager (as something like libghc-random-dev
or similar), or you may cabal install random
.
Edit in 2021 These days, cabal install
is not the way. Instead, use cabal init
to create a package and list random
in your build-depends
field. Compilation can be performed with cabal build
(just build) or cabal run
(to execute the result); interactive use is available via cabal repl
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With