[Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs
Viktor Dukhovni
ietf-dane at dukhovni.org
Mon Nov 28 19:06:34 UTC 2022
On Mon, Nov 28, 2022 at 06:54:39PM +0100, Hécate wrote:
> 2. What's the use case here?
>
> The use case is certainly my own partial worldview of how it all works.
> That being said one interesting thing is that peek & poke allow you to
> do IO, whereas Binary's Put and Get do not seem to allow me to do it
> (without cheating at least). And I couldn't find any instruction that
> said that it was okay to use unsafeDupablePerformIO (or similar) in Binary.
The use-case for Data.Binary is for converting to and from ByteStrings
(possibly lazy construction via Builders). If you want to include
reading the data from a stream, there's at least:
https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Utils-Binary.html
and equivalent options. But your answer is still at much too low a
level. What kinds of messages are these? What sort of communication
pattern is this serialisation in aid of?
- Haskell to FFI helper functions?
- Haskell process to Haskell process on the same machine?
- Haskell Process to cache for later retrieval?
- Interprocess, possily across languages and systems?
- ...
What are the interoperability requirements? ...
--
Viktor.
More information about the Haskell-Cafe
mailing list