google / haskell-trainings

Haskell 101 and 102: slides and codelabs
Apache License 2.0
1.38k stars 110 forks source link

System.Random is missing #8

Closed anaelChardan closed 5 years ago

anaelChardan commented 5 years ago

Hi, I'm trying to complete the 102 codelab but I get an error when I'm doing make:

→ make
ghc -Wall -O2 -threaded -feager-blackholing Main.hs -o codelab
[1 of 3] Compiling Codelab          ( Codelab.hs, Codelab.o )
[2 of 3] Compiling Game             ( Game.hs, Game.o )

Game.hs:29:1: error:
    Failed to load interface for ‘System.Random’
    Use -v to see a list of the files searched for.
Makefile:15: recipe for target 'codelab' failed
make: *** [codelab] Error 1

My GHC version is 8.0.1. ;) Thanks! The videos are very good by the way!

mihaimaruseac commented 5 years ago

You will have to install the random library. Are you using stack or plain cabal?

anaelChardan commented 5 years ago

Indeed, it works by installing random through cabal.

cabal update
cabal install random

I'm just starting to learning some haskell, still needs to know about the environment ;). Thanks! I close the issue! ;).

Shenmin-Z commented 4 years ago

I'm an absolute beginner, and I just made it work with stack. Posting this just in case anyone else is trying stack...

harisankarh commented 3 years ago
  • stack ghc --

made my day. couldn't figure this out even from multiple stackoverflow threads.

mihaimaruseac commented 3 years ago

We should push a completely revamped version of the codelabs where the Makefile detects what toolchain you use and use stack/cabal accordingly.

Sorry for the delay