I see myself using this pattern a lot:
f x = do
-- predicate :: a -> IO Bool
b <- predicate x
if b then
rest ()
else
return ()
where
rest () = do
-- rest of my IO operations
is there a pattern other people use to remove the if then else where clauses? How do you best work with control flow and IO Bool?
>Solution :
f x = do
b <- predicate x
when b $ do
-- rest of the IO operation