Skip to content

Allow ByteArray to be marshalled in foreign imports

Matthew Pickering requested to merge wip/marshal-bytearray into master

This allows you to use the wrapped version of ByteArray as an argument to a foreign import rather than having to manually unwrap it yourself.

For example, you can now write:

foreign import capi  unsafe "string.h strlen"
  c_strlen_capi_lifted :: ByteArray -> IO CSize

rather than

foreign import capi  unsafe "string.h strlen"
     c_strlen_capi :: ByteArray# -> IO CSize

Fixes #20620

Merge request reports