编译器说
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