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

Sven Panne svenpanne at gmail.com
Fri Oct 26 17:11:51 UTC 2018


Am Fr., 26. Okt. 2018 um 11:15 Uhr schrieb Henning Thielemann <
lemming at henning-thielemann.de>:

> [...] There are the Storable methods
>
> peekByteOff :: Ptr b -> Int -> IO a
> pokeByteOff :: Ptr b -> Int -> a -> IO ()
>
> They ignore the target types of their pointers.


... and for a good reason: This was intentionally specified this way to
avoid the castPtr-Kung-Fu which would arise if the pointer arguments were
e.g. "Ptr ()". Remember: You are on a totally unsafe level here, anyway, so
adding tons of casts would not really help here much.


> [...] And if we are touching Storable class, [...]


I really hope that Storable remains *totally* untouched, at least in the
sense that it is only changed in a 100% backwards-compatible away.
Otherwise basically the whole Haskell ecosystem with its tons of native
bindings will explode... There is nothing wrong with a new class, but this
one is effectively "untouchable".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181026/1de08999/attachment.html>


More information about the Libraries mailing list