[Haskell-cafe] do you have to use fix with forkio?

Martijn van Steenbergen martijn at van.steenbergen.nl
Sat Mar 7 17:12:36 EST 2009


Derek Elkins wrote:
> Both are poorish style.
> 
> reader <- forkIO $ forever $ do (nr', line) <- readChan; when (nr /= nr') $ putStrLn hdl line

This is fine assuming you always want to re-enter the loop. If you want 
to loop conditionally (which is most often the case), forever isn't 
going to work, unless you use exceptions.

Martijn.



More information about the Haskell-Cafe mailing list