if-then-else inside a "do"

Andre W B Furtado awfurtado@uol.com.br
Tue, 29 Jan 2002 21:40:08 -0200


In the following code, will "other things" be executed or the "return ()"
will end function f? I guess the answer is yes ("other things" WILL be
executed anyway), but I'd like to understand why won't the "return ()" be
the [state change/result produced] created by f.

f :: IO ()
f = do
    -- lots of things
    if False then doSomething else (return ())
    -- other things

Thanks,
-- Andre