On Sat, 2009-03-07 at 23:12 +0100, Martijn van Steenbergen wrote: > 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.
If you are doing something else, use something else. This makes it clear that you -aren't- going to break out (non-exceptionally), i.e. the control flow is more obvious in this code than in the other versions. By your logic 'map' would be bad because not everything is a map, of course, this is precisely why using map, when applicable, is good. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
