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.
-
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
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
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
> 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
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
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
| 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