2
The last statement in a 'do' construct must be an expression:
rmax <- getInteger
试图加载包含下面的代码片断的文件时:
getInteger :: IO Integer
getInteger = readLn
main :: IO()
main = do
putStrLn "specify upper limit of results"
rmax <- getInteger
if rmax `notElem` mot
then do putStrLn "run again and enter a multiple of 10"
else do print pAllSorted
这是什么(编译器消息)的意思,为什么会发生在这里? (而它不会在:)
main = do
line <- getLine
if null line
then return()
else do
putStrLn $ reverseWords line
main
reverseWords :: String -> String
reverseWords = unwords . map reverse . words
(例如,从http://learnyouahaskell.com/input-and-output拍摄)以上
由于rmax < - rhing不是根据您发布的内容的do构造中的最后一行,因此您可能会遇到缩进问题。确保你在任何地方都没有制表符。 – Ingo 2012-01-02 11:20:39