
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.
On Fri, Oct 26, 2018 at 4:26 PM Sven Panne
Am Fr., 26. Okt. 2018 um 22:16 Uhr schrieb Daniel Cartwright < chessai1996@gmail.com>:
I am referring to the situations when someone uses 'Ptr a', but the Ptr does not point to anything of type 'a'. If I write 'Ptr Word8', but I am pointing to a Char, then that is not true.
It might not be true, but you might be forced to do such things to use some ugly C library. The Ptr type carries some valuable information, namely: What does my C counterpart expect? It might not be 100% true on the Haskell side, but you are in "unsafe land", anyway, and at some level you *have* to be able to use some white lie when necessary. Note that I'm not saying that this is nice, but I haven't heard of a better alternative yet. _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-- -Andrew Thaddeus Martin