The compiler says
The last statement in a 'do' construct must be an expression:
rmax <- getInteger
when attempting to load a file containing the following snippets of code:
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
What does it (the compiler message) mean, and why does it occur here? (whereas it doesn't in:)
main = do
line <- getLine
if null line
then return ()
else do
putStrLn $ reverseWords line
main
reverseWords :: String -> String
reverseWords = unwords . map reverse . words
(above example taken from http://learnyouahaskell.com/input-and-output)