| But Haskell *really* needs some standard way of reading values in the
| native format on a platform:

What about this specification?

        hReadByteArray :: Handle -> MutableByteArray a -> Int -> IO Int
        -- Read the specified number of *bytes* into the byte array.
        -- Return the number of bytes actually read.
        -- By treating the result as a MutableByteArray Float (say), you
        -- get binary I/O

        hWriteByteArray :: Handle -> MutableByteArray a -> Int -> IO ()
        -- Similarly for write (but no Int returned)
        -- The 'mutable' part isn't necessary for the write, but a client
        -- will typically write an Int (say) into it just before calling.

Both may block.

Would that do what you want?  If so we can add it to IOExts.

Simon

Reply via email to