i agree with carter regarding the Storable-Ptr relationship. It seems to me that Storable is tied to Ptr. Some concrete evidence of this is in the Data.Primitive.Ptr APIOn Thu, Nov 1, 2018 at 2:26 PM Carter Schonwald <carter.schonwald@gmail.com> wrote:phrased differnetly: storable provides one (c compatible) isomorphism between fixed size values in haskell and cthe moment you want to talk about something that isn't fixed sized, like a unicode character (which is a sequence of one or more code points, which we call Char in haskell), storable doesn't apply._______________________________________________On Thu, Nov 1, 2018 at 2:23 PM Carter Schonwald <carter.schonwald@gmail.com> wrote:... Ptr *is not* tied to storable, Storable is a convenience for FFI integration .. storable is tied to ptrthere are whole MOUNTAINS of haskell code that underly this, and we can't lawyer it away with some opinionsOn Thu, Nov 1, 2018 at 2:16 PM David Feuer <david.feuer@gmail.com> wrote:Indeed. I think the point is that Ptr should be thought of as tied to Storable. If you want to use an Addr# for something else, then you shouldn't be using Ptr!On Thu, Nov 1, 2018, 2:13 PM Evan Laforge <qdunkan@gmail.com wrote:On Thu, Nov 1, 2018 at 10:47 AM Carter Schonwald
<carter.schonwald@gmail.com> wrote:
> a good example might be Ptr Char. Is this a single location of a 32bit / utf32 code point, or an array of utf8 code points or utf32 code points?
> is it null terminated vs there being an extra sequence length? These are all valid things that can be happening. And
I'm not sure if it affects your point, but I sure hope a 'Ptr Char'
points to a 4 byte haskell Char as it claims, and 'Ptr CChar' points
to a 1 byte C char, as it claims. Otherwise, sizeOf will be wrong and
array indexing will go out of bounds.
Of course, in the C case, whether or not there are further chars after
that and if they are terminated and what is the encoding is all
ambiguous, as it always is for C.
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries