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

Modulebase-compat-0.14.1Haskell2010

Foreign.Marshal.Utils.Compat

  • 12 values
valuefillBytes :: Ptr a -> Word8 -> Int -> IO ()
#

Fill a given number of bytes in memory area with a byte value.

valuenew :: Storable a => a -> IO (Ptr a)
#

Allocate a block of memory and marshal a value into it (the combination of malloc and poke). The size of the area allocated is determined by the sizeOf method from the instance of Storable for the appropriate type.

The memory may be deallocated using free or finalizerFree when no longer required.

valuecopyBytes
  1. :: Ptr a

    Destination

  2. -> Ptr a

    Source

  3. -> Int

    Size in bytes

  4. -> IO ()
#

Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may not overlap

valuemoveBytes
  1. :: Ptr a

    Destination

  2. -> Ptr a

    Source

  3. -> Int

    Size in bytes

  4. -> IO ()
#

Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may overlap

valuetoBool :: (Eq a, Num a) => a -> Bool
#

Convert a Boolean in numeric representation to a Haskell value

valuewith :: Storable a => a -> (Ptr a -> IO b) -> IO b
#

with val f executes the computation f, passing as argument a pointer to a temporarily allocated block of memory into which val has been marshalled (the combination of alloca and poke).

The memory is freed when f terminates (either normally or via an exception), so the pointer passed to f must not be used after this.

valuewithMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res
#

Replicates a withXXX combinator over a list of objects, yielding a list of marshalled objects

valuefillBytes :: Ptr a -> Word8 -> Int -> IO ()
#

Fill a given number of bytes in memory area with a byte value.