这个问题肯定是针对stackoverflow.com的
这是示例
module Main where
import Control.Monad.Random
import Control.Exception
data Tdata = Tdata Int Int Integer String
randomTdata :: (Monad m, RandomGen g) => RandT g m Tdata
randomTdata = do
a <- getRandom
b <- getRandom
c <- getRandom
return $ Tdata a b c "random"
manyTdata :: IO [Tdata]
manyTdata = do
g <- newStdGen
evalRandT (sequence $ repeat randomTdata) g
main = do
a <- manyTdata
b <- evaluate $ take 1 a
return ()
编译后返回
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it
怎么会发生?MonadRandom 不是懒惰还是什么?在这种情况下如何定义堆栈溢出的原因?