[Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs

Hécate hecate at glitchbra.in
Mon Nov 28 19:14:15 UTC 2022


Ah sorry, I misunderstood your question.

I am writing a high-level interface to my libsodium bindings, and I'm 
trying to provide implementations of helpful typeclasses.

I actually don't need Storable to do the FFI stuff, thankfully, but the 
main case of using this library would involve sending the result of the 
signing operation to the network (as ByteStrings), with authorization 
tokens like Biscuit¹ in mind.

¹ https://www.biscuitsec.org


Le 28/11/2022 à 20:06, Viktor Dukhovni a écrit :
> 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? ...
>
-- 
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: https://glitchbra.in
RUN: BSD



More information about the Haskell-Cafe mailing list