コンパイラは言う
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から取得)