Binary IO

Glynn Clements glynn at gclements.plus.com
Thu Apr 21 13:07:37 EDT 2005


John Meacham wrote:

> > Personally, I think this ought to be part of the redesign of the I/O
> > library.  hGetByte and hPutByte would be a stopgap.  But, not much
> > progress is being made on an I/O redesign right now.
> 
> but a useful stopgap, because their use would guarentee your code
> wouldn't suddenly stop working when ghc changes its IO system.
> 
> I'd like to see all of:
> readBinaryFile :: String -> IO [Word8]
> writeBinaryFile :: String -> [Word8] -> IO ()
> hGetByte :: Handle -> IO Word8
> hPutByte :: Handle -> Word8 -> IO ()
> 
> added to all the compilers. simply so there is a straightforward (if
> not ideal) portable way to do binary IO. We can worry about the ideal pecfect low
> level interface later.

Personally, I think that h{Get,Put}Byte should be an integral part of
the I/O interface. I don't see them as just a stopgap.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Libraries mailing list