简体   繁体   中英

How to resolve the import System.Random?

I get the error that couldn´t find module System.Random and I tried to do Cabal Update ; Cabal Install Random and Cabal update --lib random , in Windowns, and it assumes the same error.

I also have Ubuntu in a Virtual Box/Machine and I tried to do sudo apt-get install cabal update and it assumes, also, the same error.

The shortest path I can think of is: Consider installing Haskell Platform .

It comes with GHC and some pre-installed packages including random .

Otherwise, instead, on Ubuntu:

  • Commands are case-sensitive.

    Write commands in lowercase.

  • Install Cabal:

     sudo apt install cabal-install
  • Install the random package:

     cabal update cabal install random
  • Try and see if the package is available in GHCi:

     $ ghci ... Prelude> import System.Random Prelude System.Random>

    The things to type are ghci and import System.Random .

    Remember, uppercase/lowercase matters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM