<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Foreign.Marshal.Array</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Foreign-Marshal-Array.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >base-4.1.0.0: Basic libraries</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Foreign.Marshal.Array</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >provisional</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >ffi@haskell.org</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Marshalling arrays </A ></DT ><DD ><DL ><DT ><A HREF="#2" >Allocation </A ></DT ><DT ><A HREF="#3" >Marshalling </A ></DT ><DT ><A HREF="#4" >Combined allocation and marshalling </A ></DT ><DT ><A HREF="#5" >Copying </A ></DT ><DT ><A HREF="#6" >Finding the length </A ></DT ><DT ><A HREF="#7" >Indexing </A ></DT ></DL ></DD ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Marshalling support: routines allocating, storing, and retrieving Haskell lists that are represented as arrays in the foreign language </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AmallocArray" >mallocArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmallocArray0" >mallocArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AallocaArray" >allocaArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AallocaArray0" >allocaArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreallocArray" >reallocArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreallocArray0" >reallocArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApeekArray" >peekArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApeekArray0" >peekArray0</A > :: (<A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a, <A HREF="Data-Eq.html#t%3AEq" >Eq</A > a) => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > [a]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApokeArray" >pokeArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApokeArray0" >pokeArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AnewArray" >newArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AnewArray0" >newArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwithArray" >withArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwithArray0" >withArray0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwithArrayLen" >withArrayLen</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwithArrayLen0" >withArrayLen0</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcopyArray" >copyArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmoveArray" >moveArray</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AlengthArray0" >lengthArray0</A > :: (<A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a, <A HREF="Data-Eq.html#t%3AEq" >Eq</A > a) => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AadvancePtr" >advancePtr</A > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Marshalling arrays </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="2" ><A NAME="2" >Allocation </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mallocArray" ><A NAME="v%3AmallocArray" ></A ></A ><B >mallocArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >Allocate storage for the given number of elements of a storable type (like Foreign.Marshal.Alloc.malloc, but for multiple elements). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mallocArray0" ><A NAME="v%3AmallocArray0" ></A ></A ><B >mallocArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="Foreign-Marshal-Array.html#v%3AmallocArray" >mallocArray</A ></TT >, but add an extra position to hold a special termination element. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:allocaArray" ><A NAME="v%3AallocaArray" ></A ></A ><B >allocaArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Temporarily allocate space for the given number of elements (like Foreign.Marshal.Alloc.alloca, but for multiple elements). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:allocaArray0" ><A NAME="v%3AallocaArray0" ></A ></A ><B >allocaArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="Foreign-Marshal-Array.html#v%3AallocaArray" >allocaArray</A ></TT >, but add an extra position to hold a special termination element. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:reallocArray" ><A NAME="v%3AreallocArray" ></A ></A ><B >reallocArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >Adjust the size of an array </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:reallocArray0" ><A NAME="v%3AreallocArray0" ></A ></A ><B >reallocArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >Adjust the size of an array including an extra position for the end marker. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="3" ><A NAME="3" >Marshalling </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:peekArray" ><A NAME="v%3ApeekArray" ></A ></A ><B >peekArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > [a]</TD ></TR ><TR ><TD CLASS="doc" >Convert an array of given length into a Haskell list. This version traverses the array backwards using an accumulating parameter, which uses constant stack space. The previous version using mapM needed linear stack space. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:peekArray0" ><A NAME="v%3ApeekArray0" ></A ></A ><B >peekArray0</B > :: (<A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a, <A HREF="Data-Eq.html#t%3AEq" >Eq</A > a) => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > [a]</TD ></TR ><TR ><TD CLASS="doc" >Convert an array terminated by the given end marker into a Haskell list </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:pokeArray" ><A NAME="v%3ApokeArray" ></A ></A ><B >pokeArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="doc" >Write the list elements consecutive into memory </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:pokeArray0" ><A NAME="v%3ApokeArray0" ></A ></A ><B >pokeArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="doc" >Write the list elements consecutive into memory and terminate them with the given marker element </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="4" ><A NAME="4" >Combined allocation and marshalling </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:newArray" ><A NAME="v%3AnewArray" ></A ></A ><B >newArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >Write a list of storable elements into a newly allocated, consecutive sequence of storable values (like Foreign.Marshal.Utils.new, but for multiple elements). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:newArray0" ><A NAME="v%3AnewArray0" ></A ></A ><B >newArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a)</TD ></TR ><TR ><TD CLASS="doc" >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 </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:withArray" ><A NAME="v%3AwithArray" ></A ></A ><B >withArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Temporarily store a list of storable values in memory (like Foreign.Marshal.Utils.with, but for multiple elements). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:withArray0" ><A NAME="v%3AwithArray0" ></A ></A ><B >withArray0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> (<A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="Foreign-Marshal-Array.html#v%3AwithArray" >withArray</A ></TT >, but a terminator indicates where the array ends </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:withArrayLen" ><A NAME="v%3AwithArrayLen" ></A ></A ><B >withArrayLen</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => [a] -> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="Foreign-Marshal-Array.html#v%3AwithArray" >withArray</A ></TT >, but the action gets the number of values as an additional parameter </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:withArrayLen0" ><A NAME="v%3AwithArrayLen0" ></A ></A ><B >withArrayLen0</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => a -> [a] -> (<A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > b) -> <A HREF="System-IO.html#t%3AIO" >IO</A > b</TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="Foreign-Marshal-Array.html#v%3AwithArrayLen" >withArrayLen</A ></TT >, but a terminator indicates where the array ends </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="5" ><A NAME="5" >Copying </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="doc" >(argument order: destination, source) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:copyArray" ><A NAME="v%3AcopyArray" ></A ></A ><B >copyArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="doc" >Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may <EM >not</EM > overlap </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:moveArray" ><A NAME="v%3AmoveArray" ></A ></A ><B >moveArray</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="doc" >Copy the given number of elements from the second array (source) into the first array (destination); the copied areas <EM >may</EM > overlap </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="6" ><A NAME="6" >Finding the length </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:lengthArray0" ><A NAME="v%3AlengthArray0" ></A ></A ><B >lengthArray0</B > :: (<A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a, <A HREF="Data-Eq.html#t%3AEq" >Eq</A > a) => a -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A ></TD ></TR ><TR ><TD CLASS="doc" >Return the number of elements in an array, excluding the terminator </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="7" ><A NAME="7" >Indexing </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:advancePtr" ><A NAME="v%3AadvancePtr" ></A ></A ><B >advancePtr</B > :: <A HREF="Foreign-Storable.html#t%3AStorable" >Storable</A > a => <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a -> <A HREF="../ghc-prim/GHC-Types.html#t%3AInt" >Int</A > -> <A HREF="Foreign-Ptr.html#t%3APtr" >Ptr</A > a</TD ></TR ><TR ><TD CLASS="doc" >Advance a pointer into an array by the given number of elements </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.4.2</TD ></TR ></TABLE ></BODY ></HTML >