Haskell Could not find module `System’

haskell

I'm new with Haskell and have trouble with its package.

I want to import System.Random but

Could not find module `System.Random'

Then I tried to import System but

Could not find module `System'.

It is a member of the hidden package `haskell98-2.0.0.0'.


I tried to search this problem, but those solutions still don't work.

As this said, I tried to install cabal on my Mac OS X using MacPort, but

Error: The following dependencies were not installed: ghc
Error: Status 1 encountered during processing.

I have installed Haskell Platform and can use ghci in command-line.
GHCi, version 7.2.1


Then I tried to use ghc-pkg expose haskell98-2.0.0.0 as this one says.

But this time, I can't even run ghci.

Top level:

Ambiguous interface for `Prelude':

it was found in multiple packages: base haskell98-2.0.0.0


So, what can I do without using cabal?

Best Answer

The System.Random module belongs to the random package, which is no longer included with GHC as of version 7.2.1.

I'm not sure what to do about your Cabal problem, as I'm not familiar with Mac OS X, but I'd recommend getting that to work first. Installing random should then be trivial using Cabal.

As a possible workaround, you might want to consider using an older version of GHC.

Related Topic