Proposal: Move primitive-Data.Primitive.Addr API into base

Daniel Cartwright chessai1996 at gmail.com
Fri Oct 26 20:58:06 UTC 2018


There is no operational difference when using `Ptr a` vs `Addr` in such a
case. The problem lies in the type variable `a`. Types are here to guide us
- if I use `Ptr Word8`, and this Ptr is not a Ptr to Word8, there is not
much enforcing this. In such cases, the type annotation is untruthful. We
would like it more often than not to be truthful. Yes, in the underlying C,
there exists suboptimal typing, but that is why we are not writing in C,
and instead lifting the code to Haskell.

On Fri, Oct 26, 2018 at 4:38 PM Sven Panne <svenpanne at gmail.com> wrote:

> Am Fr., 26. Okt. 2018 um 22:31 Uhr schrieb Andrew Martin <
> andrew.thaddeus at gmail.com>:
>
>> The better alternative suggested in this thread is to use Addr instead.
>> That way, you don't have to lie about the type of the serialized data that
>> the pointer is pointing to.
>>
>
> Even if I'm repeating myself: That is not lying, quite the opposite. If
> you e.g. use a C library with suboptimal typing (i.e. more often than not),
> you make the impedance matching explicit. How would you achieve that with
> Addr?
>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181026/0e4dc21c/attachment.html>


More information about the Libraries mailing list