Ptr and ForeignPtr Questions

Ashley Yakeley
Sun, 23 Sep 2001 16:07:50 -0700

At 2001-09-23 15:56, Marcin 'Qrczak' Kowalczyk wrote:

>> But do you have an example of a Haskell type for a foreign import 
>> function, for which the corresponding C function type would be ambiguous?
>Ptr CChar (as an argument). It could be either char * or const char *.

It's always char*. A Haskell function passed a Ptr CChar is not prevented 
from modifying the contents of the pointer simply due to its 
type-declaration. In C, a char* can be implicitly converted to a const 
char* where necessary (but not the other way around).

Ashley Yakeley, Seattle WA