2017-09-13 54 views
0

我一直在haskell中編寫一些代碼,而我剛剛遇到了上述錯誤。我在這裏看到了答案,但找不到解決我的問題的答案。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)) 

跟它它未能在解析「讓listOfCtordecl ......」

回答

1

你忘了關上這一行的括號:

rng <- (randomRS (5 :: Int, 7 :: Int) 

它應該是:

rng <- (randomRS (5 :: Int, 7 :: Int)) 
相關問題