Possible Duplicate:
Haskell “do nothing” IO, or if without else
Something got wrong in these "easy" lines ...
action = do
isdir <- doesDirectoryExist path -- check if directory exists.
if(not isdir)
then do handleWrong
doOtherActions -- compiling ERROR here.
GHCi will complaint about identifiers , or do not exec the last line action after I add else do
.
I think exception handling may work, but is it necessary in such common "check and do something" statements ?
Thanks.
when
seems to be cleaner – Bozovich