RE: binary IO

2000-03-09 Thread Sigbjorn Finne
The impl for this kind of stuff is already in there: hFillBufBA :: Handle -> ByteArray Int -> Int -> IO Int hPutBufBA :: Handle -> ByteArray Int -> Int -> IO () hFillBuf :: Handle -> Addr -> Int -> IO Int hPutBuf:: Handle -> Addr -> Int -> IO () all available from PrelHandle. -

RE: Qualified names in foreign export

2000-03-09 Thread Sigbjorn Finne
Sven Panne <[EMAIL PROTECTED]> writes: > > Marcin 'Qrczak' Kowalczyk wrote: > > [...] Maybe it would be enough to allow to omit a type signature for > > foreign export? It's probably already somewhere else. But GHC allows > > the foreign export signature to be more specific than the real > > sig

Re: Qualified names in foreign export

2000-03-09 Thread Marcin 'Qrczak' Kowalczyk
Thu, 09 Mar 2000 16:01:37 +0100, Sven Panne <[EMAIL PROTECTED]> pisze: > To be honest, I never knew that the following is indeed allowed: > >module Foo where >foreign export bar :: Int -> IO () >bar :: a -> IO () >bar _ = putStrLn "baz" > > I'm not sure what the rationale behin

Re: Qualified names in foreign export

2000-03-09 Thread Sven Panne
Marcin 'Qrczak' Kowalczyk wrote: > [...] Maybe it would be enough to allow to omit a type signature for > foreign export? It's probably already somewhere else. But GHC allows > the foreign export signature to be more specific than the real > signature: it does not constrain the type of the functio

RE: binary IO

2000-03-09 Thread Simon Marlow
> That's not what I had in mind: Given the Glorious FFI lib, Addr would > be much better than MutableByteArrays, I'm not really participating in this discussion, but this point struck me as odd. Why should one use Addr rather than (Mutable)ByteArray? - because Addrs don't move, so you c

Re: binary IO

2000-03-09 Thread Sven Panne
Simon Peyton-Jones wrote: > What about this specification? > > hReadByteArray :: Handle -> MutableByteArray a -> Int -> IO Int > [...] > hWriteByteArray :: Handle -> MutableByteArray a -> Int -> IO () > [...] > Both may block. > > Would that do what you want? If so we can add it

Re: binary IO

2000-03-09 Thread George Russell
Simon Peyton-Jones wrote: > > | But Haskell *really* needs some standard way of reading values in the > | native format on a platform: > > What about this specification? It looks too slow and inflexible to me. If I just want to get at the byte representation of a Float, I have to create a whole

RE: binary IO

2000-03-09 Thread Simon Peyton-Jones
| 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