yashiganiの英傑になるまで死ねない日記

週末はマスターバイクでハイラルを走り回ります

System.Randomがバンドルされなくなってた

すごいH本の9章読んでて,乱数を生成するところまできたのでサンプルを写経してみたら怒られた.

<no location info>:
    Could not find module `System.Random'
    It is not a module in the current program, or in any known package.

ググってみると,どうやらghc7.2.1からSystem.Randomはバンドルされなくなったらしい. てなわけで,brewcabalをインストールして解決.cabalのインストール後にSystem.Randomcabal installする必要はなくて,cabalをインストールしたらSystem.Randomもインストールされた.

無事インストールしたし,試してみる.

> import System.Random
> mkStdGen 1
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package time-1.4 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
2 1

できた. これやって気づいたけど,Haskellではライブラリさえ遅延ロードされるようだ.

参考

http://stackoverflow.com/questions/7265550/haskell-could-not-find-module-system

すごいHaskellたのしく学ぼう!

すごいHaskellたのしく学ぼう!

すごいHaskellたのしく学ぼう!

すごいHaskellたのしく学ぼう!