
Hi, I am writing a recursive function which does some IO operation. I encounter situation in which my function has to end recursion by doing "nothing" and otherwise keep calling same function with some different parameters. I did not find anything equivalent to "pass" or "return" statement in Haskell. Presently I have got a workaround. I am doing it by putting a dummy print as described below. can anybody help me in this? e.g f some_params = if some_condition then do putStr "Hacky way to do nothing!" else do perform_some_IO f some_other_params == Vikrant

vikrant.patil:
Hi, I am writing a recursive function which does some IO operation. I encounter situation in which my function has to end recursion by doing "nothing" and otherwise keep calling same function with some different parameters. I did not find anything equivalent to "pass" or "return" statement in Haskell. Presently I have got a workaround. I am doing it by putting a dummy print as described below. can anybody help me in this? e.g f some_params = if some_condition then do putStr "Hacky way to do nothing!" else do perform_some_IO f some_other_params
Two usual ways: import Control.Monad f xs | condition = return () | otherwise = do io f ys f xs = when (not.condition) $ do io f ys

Hello Vikrant, Tuesday, February 20, 2007, 10:59:16 AM, you wrote:
I encounter situation in which my function has to end recursion by doing "nothing" and otherwise keep calling same function with some different parameters. I did not find anything equivalent to "pass" or "return" statement in Haskell.
return () when (cond) $ do statements unless (cond) $ do statements if cond then statement else do statements -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (3)
-
Bulat Ziganshin
-
dons@cse.unsw.edu.au
-
Vikrant