Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

System.Random in Haskell?

Hello. I'm a complete Haskell noob, so I'm probably missing something obvious here. I can't seem to import the System.Random module. I've tried import System.Random but it throws an error. The exact error is as follows:

Could not find module 'System.Random'
Use -v to see a list of the files searched for.
|
3 | import System.Random
| ^^^^^^^^^^^^^^^^^^^^
compiler exit status 1

Anyway, the module (is it a module?) was going to be used to select a random element from a list, detailed in list.hs
I think it may be possible to do it using the IO monad, but as I said earlier I don't really have any idea what I'm doing.
Any help would be greatly appreciated.

Edit 1:
On a related note, Go doesn't seem to want to import the "math/rand" package either! It throws an error saying that no metadata was found for the package. I think I'm seeing a pattern here...

3 years ago
You are viewing a single comment. View All
2
JackFly26
JackFly26

System.Random isn't part of the base part of haskell; it's in the random package. You'll need to make a cabal project and run it after installing the random package.

3 years ago