Converting things to and from binary

Simon Marlow
Wed, 21 May 2003 11:52:00 +0100

> (2) the York Binary library uses the IO monad, and presumably
> various variables within a BinHandle, to keep track of state.
> I think this is unnecessary, for example I don't think the
> process of converting a value to a byte array should really
> have to go through IO.  We are supposed to be functional
> programmers after all.

When writing to a BinMem it would be possible to avoid the IO monad, and
use something like the ST monad instead.  However, I'm not sure it's
worth making this generalisation, since it would necessarily complicate
the library quite a bit.

Do you have an application where being in the IO monad to do this stuff
isn't possible, or is inconvenient?