Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ubuntu haskell ghci 7.4.1 could not find module "System.Random"

Tags:

haskell

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

like image 490
Mike Avatar asked Jun 17 '12 01:06

Mike


1 Answers

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.

like image 111
Daniel Wagner Avatar answered Nov 11 '22 01:11

Daniel Wagner