Word8-Based IO

Wolfgang Jeltsch wolfgang@jeltsch.net
21 Aug 2002 20:52:56 +0200


On Wednesday, 2002-08-21, 09:52, CEST, Ketil Z. Malde wrote:
> [...]
> I don't particularly like 'octet' (probably because I find it a bit
> pedantic, and it reminds me too much of committee decisions), and
> would prefer hGetWord8 or even hGetByte/hGetWord.

hGetWord8 sounds better to me than hGetOctet, at least as long as we
have nothing like
    type Octet = Word8.

> Also, I find 'Array' a bit uncomfortable -- it's a list, isn't it?

As I also said in my earlier mail.

> But why not simply:
> 
>         hPutOctet (or Word, Word8, Byte) :: Handle -> Word8 -> IO ()
>         hPutOctets (hPutWords, Bytes) :: Handle -> [Word8] -> IO ()
> and
>         hGetOctet :: Handle -> IO Word8
>         hGetOctets :: Handle -> IO [Word8] -- hGetContents-alike

It's nice to use just the plural of octet. But what I dislike a bit is
that hPutOctets and hGetOctets don't really correspond to each other
because hGetOctets isn't the "inversion" of hPutOctets. I mean,
hGetOctets won't generally read exactly those octets an earlier
invocation of hPutOctets put but occasionally more than these.

> (I'd rather annotate the strict versions, lazy is usually the default)

I think so, too.

> I'd also like a 'readFile'-like function for octets, I find my
> programs do a lot of their IO by lazily reading files, and being able
> to bury all the handle-stuff is a good thing, IMHO.

Good point.

> [...]

Wolfgang