Commit 0d413259 authored by Andrew Martin's avatar Andrew Martin Committed by Marge Bot
Browse files

[skip ci] make the table better

parent a70db7bf
...@@ -71,6 +71,8 @@ GHC extensions to the FFI Chapter ...@@ -71,6 +71,8 @@ GHC extensions to the FFI Chapter
The FFI features that are described in this section are specific to GHC. The FFI features that are described in this section are specific to GHC.
Your code will not be portable to other compilers if you use them. Your code will not be portable to other compilers if you use them.
.. _ffi-unlifted-types:
Unlifted FFI Types Unlifted FFI Types
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
...@@ -109,16 +111,24 @@ very difficult to track down. (The errors likely will not manifest ...@@ -109,16 +111,24 @@ very difficult to track down. (The errors likely will not manifest
until garbage collection happens.) In tabular form, these restrictions until garbage collection happens.) In tabular form, these restrictions
are: are:
+------------------+----------------------------------------------------+ +--------------------------------+-----------------------------------------------------+
| | When value is used as argument to FFI call that is | | | When value is used as argument to FFI call that is |
+------------------+-----------------------+----------------------------+ +--------------------------------+-------------------------+---------------------------+
| Type | Safe | Unsafe | | | ``foreign import safe`` | ``foreign import unsafe`` |
+------------------+-----------------------+----------------------------+ +--------------------------------+-----------+-------------+-----------+---------------+
| ``Array#`` | Unsound | Sound, not useful | | Argument Type | reads are | writes are | reads are | writes are |
| ``SmallArray#`` | Unsound | Sound, not useful | +--------------------------------+-----------+-------------+-----------+---------------+
| ``ArrayArray#`` | Unsound | Sound | | ``Array#`` | Unsound | Unsound | Sound | Unsound |
| ``ByteArray#`` | Sound if pinned | Sound | | ``MutableArray#`` | Unsound | Unsound | Sound | Unsound |
+------------------+-----------------------+----------------------------+ | ``SmallArray#`` | Unsound | Unsound | Sound | Unsound |
| ``MutableSmallArray#`` | Unsound | Unsound | Sound | Unsound |
| ``ArrayArray#`` | Unsound | Unsound | Sound | Unsound |
| ``MutableArrayArray#`` | Unsound | Unsound | Sound | Unsound |
| unpinned ``ByteArray#`` | Unsound | Unsound | Sound | Unsound |
| unpinned ``MutableByteArray#`` | Unsound | Unsound | Sound | Sound |
| pinned ``ByteArray#`` | Sound | Unsound | Sound | Unsound |
| pinned ``MutableByteArray#`` | Sound | Sound | Sound | Sound |
+--------------------------------+-----------+-------------+-----------+---------------+
When passing any of the unlifted array types as an argument to When passing any of the unlifted array types as an argument to
a foreign C call, a foreign function sees a pointer that refers to the a foreign C call, a foreign function sees a pointer that refers to the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment