Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Miscellaneous utility functions for marshalling values to/from C. The most
notable thing in this module is the Freeable
typeclass.
Synopsis
- c'free :: Ptr () -> IO ()
- p'free :: FunPtr (Ptr a -> IO ())
- freeMaybePtr :: Ptr () -> IO ()
- class Freeable a where
- rlFreeMaybeArray :: (Freeable a, Storable a) => Maybe [a] -> Ptr a -> IO ()
- pop :: (Freeable a, Storable a) => Ptr a -> IO a
- popCArray :: (Freeable a, Storable a) => Int -> Ptr a -> IO [a]
- popCString :: CString -> IO String
- withFreeable :: (Freeable a, Storable a) => a -> (Ptr a -> IO b) -> IO b
- withFreeableArray :: (Freeable a, Storable a) => [a] -> (Ptr a -> IO b) -> IO b
- withFreeableArrayLen :: (Freeable a, Storable a) => [a] -> (Int -> Ptr a -> IO b) -> IO b
- withFreeableArray2D :: (Freeable a, Storable a) => [[a]] -> (Ptr (Ptr a) -> IO b) -> IO b
- configsToBitflag :: Enum a => [a] -> Integer
- withMaybe :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b
- withMaybeCString :: Maybe String -> (CString -> IO b) -> IO b
- withCStringBuffer :: String -> Maybe Int -> (Int -> CString -> IO b) -> IO (b, String)
- peekMaybe :: Storable a => Ptr (Ptr a) -> IO (Maybe a)
- peekMaybeOff :: Storable a => Ptr (Ptr a) -> Int -> IO (Maybe a)
- pokeMaybe :: Storable a => Ptr (Ptr a) -> Maybe a -> IO ()
- pokeMaybeOff :: Storable a => Ptr (Ptr a) -> Int -> Maybe a -> IO ()
- peekMaybeArray :: Storable a => Int -> Ptr a -> IO (Maybe [a])
- newMaybeArray :: Storable a => Maybe [a] -> IO (Ptr a)
- peekStaticArray :: Storable a => Int -> Ptr a -> IO [a]
- peekStaticArrayOff :: Storable a => Int -> Ptr a -> Int -> IO [a]
- pokeStaticArray :: Storable a => Ptr a -> [a] -> IO ()
- pokeStaticArrayOff :: Storable a => Ptr a -> Int -> [a] -> IO ()
- rightPad :: Int -> a -> [a] -> [a]
Documentation
freeMaybePtr :: Ptr () -> IO () Source #
class Freeable a where Source #
A typeclass used internally to free complex data types. You will most
likely not have to use this directly. If you do need to implement it, you
can probably just stick with the default definitions of rlFree
and
rlFreeDependents
.
Nothing
rlFreeDependents :: a -> Ptr a -> IO () Source #
Frees the data "dependent" on a pointer, which usually means dynamic C arrays, i.e. more pointers
rlFree :: a -> Ptr a -> IO () Source #
Receives a pointer and frees all of the data associated with it, including the pointer itself
Instances
configsToBitflag :: Enum a => [a] -> Integer Source #