wiki:BinaryIO

Version 2 (modified by ross@…, 8 years ago) (diff)

--

Binary I/O

Haskell 98 treats I/O as character-based, and lacks a mechanism for binary I/O. It is currently impossible to read or write binary data in a portable manner.

  • Character-based I/O is needed, at least because systems (e.g. Unix and Windows) have different line-termination conventions that should be hidden from programs. The problem becomes more acute when different environments use different character sets and encodings (see Unicode).
  • Binary I/O is needed both to handle binary data and as a base upon which general treatment s of character-encoding conversions (see Unicode) may be layered.

The proposal is to add a form of I/O over Word8 (i.e. octets, 8-bit binary values). See the "Binary input and output" section of System.IO for a rough design.