我已经在haskell中编写了一些代码,我刚刚遇到了上面的错误。我已经在这里寻找答案了,但找不到解决我问题的答案。
makeCtordecls :: RandomGen g => String -> RandomState g [Ctordecl]
makeCtordecls tp = do
rng <- (randomRS (5 :: Int, 7 :: Int)
let listOfCtordecl = replicateCountM rng (makeCtordecl (tp))
return listOfCtordecl
replicateCountM :: (Applicative m) => Int -> (Int -> m a) -> m [a]
replicateCountM cnt0 f =
loop cnt0
where
loop cnt
| cnt <= 0 = pure []
| otherwise = liftA2 (:) (f cnt) (loop (cnt - 1))
它说它无法解析&#34;让listOfCtordecl ....&#34;
答案 0 :(得分:1)
你忘了关闭这条线上的人:
rng <- (randomRS (5 :: Int, 7 :: Int)
应该是:
rng <- (randomRS (5 :: Int, 7 :: Int))