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

Safe HaskellNone

Bindings.Utilities

Synopsis

Documentation

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

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]