
Hal Daume III wrote:>>>Do you have an application where being in the IO monad to do this stuff
isn't possible, or is inconvenient?
No. But it is inelegant, since IO is the *only* way the bit consumer has of preserving state. So if for example the target is a list of arrays and bytes, it would be necessary to hold the list inside an IORef or something similar.
You lost me here :). I can easily agree with "it is inelegant", but I think that as soon as you start talking about binary representations of data types, you have to give up some elegance.
I don't understand your example of the bit consumer and IORefs though...could you explain it a bit more (no pun)?
See the message I just posted the libraries list for a better example. http://haskell.org/pipermail/libraries/2003-May/001006.html Another one would be where you want to read some data from an untrusted client, limiting the number of bytes you can be bothered to read. This could be done using my framework by extending the monad with a count, it can't be done in Malcolm's framework, at least not without introducing an extra first step to do the IO. Malcolm, I hope you'll forgive me for being so rude about your work. Standing on the shoulders of giants, and all that ... best wishes to all, George