HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleunix-bytestring-0.4.0.1Haskell2010

System.Posix.Types.Iovec

Imports the C struct iovec type and provides conversion between CIovecs and strict ByteStrings.

  • 1 type
  • 4 values

The struct iovec type

5 declarations

O(1) construction Convert a ByteString into an CIovec.

This function is unsafe in two ways:

  • After calling this function the CIovec shares the underlying byte buffer with the original ByteString. Thus, modifying the CIovec either in C or using poke will cause the contents of the ByteString to change, breaking referential transparency. Other ByteStrings created by sharing (such as those produced via take or drop) will also reflect these changes.

  • Also, even though the CIovec shares the underlying byte buffer, it does so in a way that will not keep the original ByteString alive with respect to garbage collection. Thus, the byte buffer could be collected out from under the CIovec. To prevent this, you must use touchByteString after the last point where the CIovec is needed.