Okada Hiroshi の blog

typo が多いです

Haskell 勉強記録 25 日目

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

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

今日は 第9章:もっと入力、もっと出力 ランダム性の途中まで (位置 4753/11175) まで読み進めました。

サンプルでは finiteRandoms :: (RandomGen g, Random a, Num n) となっているのですが。

    Could not deduce (Eq n) arising from the literal `0'
    from the context (Rand.RandomGen g, Rand.Random a, Num n)
      bound by the type signature for
                 finiteRandoms :: (Rand.RandomGen g, Rand.Random a, Num n) =>
                                  n -> g -> ([a], g)

というエラーが出てしまったので

finiteRandoms :: (RandomGen g, Random a, Integral n) にしました。

今まで出てきた関数