Is there any problem if the same function that calls "mainloop" returns a value? Ex.: main :: IO () main = do msg <- startGL putStrLn msg startGL :: IO String startGL = do -- init GLUT -- create window -- declare callback procedures mainloop return "ok"