Could You tell my why I have error 'Couldn't match expected type IO t against inferred type String' - see below to see bad line:
data RectangleType = Rectangle Int Int Int deriving(Show)
menuRectangles :: [RectangleType] -> IO [RectangleType]
menuRectangles rs = do
putStrLn "Please choose option:"
putStrLn "3 - Show all rectangles"
putStrLn "4 - Quit"
putStr "Number: "
n <- getLine
case n of
"3" -> do { showRectangles rs; menuRectangles rs } -- this line is wrong
"4" -> do { putStrLn "Quitting"; return rs }
otherwise -> do { putStrLn "The End"; return rs }
showRectangles :: [RectangleType] -> String
showRectangles x = showingRectangles x
showingRectangles [] = "Empty"
showingRectangles (x:xs) = do printRectangle x
showingRectangles xs
printRectangle :: RectangleType -> String
printRectangle (Rectangle id width height) = "id: " ++ show id ++ "width: " ++ show width ++ "height: " ++ show height ++ "\n";