Infinite random sequence loops with randomIO but not with getRandom
问题 I'm having difficulty trying to figure out a way to reason about why the following two, seemingly equivalent definitions of an infinite random number sequence ( inf and inf' ) are evaluated completely differently: import Control.Monad.Random (Rand, evalRandIO, getRandom) import System.Random (Random, RandomGen, randomIO) inf :: (RandomGen g, Random a) => Rand g [a] inf = sequence (repeat getRandom) inf' :: (Random a) => IO [a] inf' = sequence (repeat randomIO) -- OK main = do i <- evalRandIO