Add explicit `{-# LANGUAGE CPP, PackageImports #-}` pragmas
[packages/haskell2010.git] / Foreign / Marshal / Utils.hs
1 {-# LANGUAGE CPP, PackageImports #-}
2 #if __GLASGOW_HASKELL__ >= 701
3 {-# LANGUAGE Safe #-}
4 #endif
5
6 module Foreign.Marshal.Utils (
7 -- * General marshalling utilities
8
9 -- ** Combined allocation and marshalling
10 --
11 with, -- :: Storable a => a -> (Ptr a -> IO b) -> IO b
12 new, -- :: Storable a => a -> IO (Ptr a)
13
14 -- ** Marshalling of Boolean values (non-zero corresponds to 'True')
15 --
16 fromBool, -- :: Num a => Bool -> a
17 toBool, -- :: Num a => a -> Bool
18
19 -- ** Marshalling of Maybe values
20 --
21 maybeNew, -- :: ( a -> IO (Ptr a))
22 -- -> (Maybe a -> IO (Ptr a))
23 maybeWith, -- :: ( a -> (Ptr b -> IO c) -> IO c)
24 -- -> (Maybe a -> (Ptr b -> IO c) -> IO c)
25 maybePeek, -- :: (Ptr a -> IO b )
26 -- -> (Ptr a -> IO (Maybe b))
27
28 -- ** Marshalling lists of storable objects
29 --
30 withMany, -- :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res
31
32 -- ** Haskellish interface to memcpy and memmove
33 -- | (argument order: destination, source)
34 --
35 copyBytes, -- :: Ptr a -> Ptr a -> Int -> IO ()
36 moveBytes, -- :: Ptr a -> Ptr a -> Int -> IO ()
37
38 ) where
39 import "base" Foreign.Marshal.Utils