Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread David Menendez
Glynn Clements writes: > > The problem is that API for that yet is not even designed, so > > programs can't be written such that they will work after the > > default encoding change. > > Personally, I would take the C approach: redefine Char to mean a byte > (i.e. CChar), treat string literals as

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Jan-Willem Maessen - Sun Labs East
Abraham Egnor wrote: Passing a Ptr isn't that onerous; it's easy enough to make functions that have the signature you'd like: import System.IO import Data.Word (Word8) import Foreign.Marshal.Array hPutBytes :: Handle -> [Word8] -> IO () hPutBytes h ws = withArray ws $ \p -> hPutBuf h p $ length ws

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Jan-Willem Maessen - Sun Labs East
Glynn Clements wrote: Actually, the more I think about it, the more I think that "simple, stupid programs" probably shouldn't be using Unicode at all. I.e. Char, String, string literals, and the I/O functions in Prelude, IO etc should all be using bytes, with a distinct wide-character API available

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements <[EMAIL PROTECTED]> writes: >> 1. API for manipulating byte sequences in I/O (without representing >>them in String type). > > Note that this needs to include all of the core I/O functions, not > just reading/writing streams. E.g. FilePath is currently an alias for > String, but

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Glynn Clements
Marcin 'Qrczak' Kowalczyk wrote: > >> 1. API for manipulating byte sequences in I/O (without representing > >>them in String type). > > > > Note that this needs to include all of the core I/O functions, not > > just reading/writing streams. E.g. FilePath is currently an alias for > > String,

Re: [Haskell-cafe] Writing binary files?

2004-09-13 Thread Ketil Malde
Glynn Clements <[EMAIL PROTECTED]> writes: > Right now, the attempt at providing I18N "for free", by defining Char > to mean Unicode, has essentially backfired, IMHO. Anything that isn't > ISO-8859-1 just doesn't work for the most part, and anyone who wants Basically, I'm inclined to agree with w