bindings-DSL-1.0.25: FFI domain specific language, on top of hsc2hs.

Safe Haskell | Safe-Inferred
Language | Haskell98

Bindings.Utilities

Synopsis

- storableCast :: (Storable a, Storable b) => a -> IO b
- storableCastArray :: (Storable a, Storable b) => [a] -> IO [b]

# Documentation

storableCast :: (Storable a, Storable b) => a -> IO b Source #

`storableCast` works like `storableCastArray`, except that it takes a single value and returns a single value.

storableCastArray :: (Storable a, Storable b) => [a] -> IO [b] Source #

`storableCastArray` takes a list of values of a first type, stores it at a contiguous memory area (that is first blanked with 0s), and then reads it as if it was a list of a second type, with enough elements to fill at least the same space.

    ghci
    :m + Bindings.Sandbox Data.Int
    storableCastArray (replicate 13 (1::Int8)) :: IO [Int32]
            ==> [16843009,16843009,16843009,1]