- module Foreign
- module CForeign
- withCStringLenIntConv :: Integral b => String -> ((Ptr CChar, b) -> IO a) -> IO a
- peekCStringLenIntConv :: Integral t => (Ptr CChar, t) -> IO String
- withIntConv :: (Storable b, Integral a, Integral b) => a -> (Ptr b -> IO c) -> IO c
- withFloatConv :: (Storable b, RealFloat a, RealFloat b) => a -> (Ptr b -> IO c) -> IO c
- peekIntConv :: (Storable a, Integral a, Integral b) => Ptr a -> IO b
- peekFloatConv :: (Storable a, RealFloat a, RealFloat b) => Ptr a -> IO b
- withBool :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b
- peekBool :: (Integral a, Storable a) => Ptr a -> IO Bool
- withEnum :: (Enum a, Integral b, Storable b) => a -> (Ptr b -> IO c) -> IO c
- peekEnum :: (Enum a, Integral b, Storable b) => Ptr b -> IO a
- nothingIf :: (a -> Bool) -> (a -> b) -> a -> Maybe b
- nothingIfNull :: (Ptr a -> b) -> Ptr a -> Maybe b
- combineBitMasks :: (Enum a, Bits b) => [a] -> b
- containsBitMask :: (Bits a, Enum b) => a -> b -> Bool
- extractBitMasks :: (Bits a, Enum b, Bounded b) => a -> [b]
- cIntConv :: (Integral a, Integral b) => a -> b
- cFloatConv :: (RealFloat a, RealFloat b) => a -> b
- cToBool :: Num a => a -> Bool
- cFromBool :: Num a => Bool -> a
- cToEnum :: (Integral i, Enum e) => i -> e
- cFromEnum :: (Enum e, Integral i) => e -> i
Re-export the language-independent component of the FFI
module Foreign
Re-export the C language component of the FFI
module CForeign
Composite marshalling functions
Conditional results using Maybe
nothingIfNull :: (Ptr a -> b) -> Ptr a -> Maybe bSource
Instance for special casing null pointers.
Bit masks
combineBitMasks :: (Enum a, Bits b) => [a] -> bSource
containsBitMask :: (Bits a, Enum b) => a -> b -> BoolSource
extractBitMasks :: (Bits a, Enum b, Bounded b) => a -> [b]Source
Given a bit pattern, yield all bit masks that it contains.
- This does *not* attempt to compute a minimal set of bit masks that when combined yield the bit pattern, instead all contained bit masks are produced.
Conversion between C and Haskell types
cFloatConv :: (RealFloat a, RealFloat b) => a -> bSource
Floating conversion