Proposal: give Ptr a nominal role

Evan Laforge qdunkan at gmail.com
Thu Nov 1 18:13:06 UTC 2018


On Thu, Nov 1, 2018 at 10:47 AM Carter Schonwald
<carter.schonwald at 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.


More information about the Libraries mailing list