HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulebase-4.20.2.0Haskell2010

Foreign.Marshal.Array

Marshalling support: routines allocating, storing, and retrieving Haskell lists that are represented as arrays in the foreign language

  • 22 values
  • Packagebase-4.20.2.0
  • Exports22
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceArray.hs

Marshalling arrays

0 declarations

Allocation

Marshalling

valuepeekArray :: Storable a => Int -> Ptr a -> IO [a]
#

Convert an array of given length into a Haskell list. The implementation is tail-recursive and so uses constant stack space.

valuepeekArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO [a]
#

Convert an array terminated by the given end marker into a Haskell list

valuepokeArray0 :: Storable a => a -> Ptr a -> [a] -> IO ()
#

Write the list elements consecutive into memory and terminate them with the given marker element

Combined allocation and marshalling

valuenewArray :: Storable a => [a] -> IO (Ptr a)
#

Write a list of storable elements into a newly allocated, consecutive sequence of storable values (like new, but for multiple elements).

valuenewArray0 :: Storable a => a -> [a] -> IO (Ptr a)
#

Write a list of storable elements into a newly allocated, consecutive sequence of storable values, where the end is fixed by the given end marker

valuewithArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b
#

Temporarily store a list of storable values in memory (like with, but for multiple elements).

Copying

(argument order: destination, source)

valuecopyArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()
#

Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may not overlap

valuemoveArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()
#

Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may overlap

Finding the length

Indexing