google / haskell-trainings

Haskell 101 and 102: slides and codelabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System.Random is missing

anaelChardan opened this issue · comments

commented

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!

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

commented

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! ;).

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

  • install random by stack install random
  • change ghc to stack ghc -- in Makefile
  • stack ghc --

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

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