[Haskell-cafe] do you have to use fix with forkio?
Donn Cave
donn at avvanta.com
Thu Mar 5 20:27:11 EST 2009
Quoth Jonathan Cast <jonathanccast at fastmail.fm>:
> You can certainly use let:
>
> reader <- forkIO $ let loop = do
> (nr', line) <- readChan chan'
> when (nr /= nr') $ hPutStrLn hdl line
> loop
> in loop
>
> But the version with fix is clearer (at least to people who have fix in
> their vocabulary) and arguably better style.
Would you mind presenting the better style argument? To me, the
above could not be clearer, so it seems like the version with fix
could be only as clear, at best.
Thanks,
Donn cave
PS - granted that "forever" is a fine alternative to either, I suppose
it doesn't affect the style comparison above.
More information about the Haskell-Cafe
mailing list