haskell-gi-base 0.18.4 → 0.19
raw patch · 3 files changed
+11/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.GI.Base.Utils: convertFunPtrIfNonNull :: FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
Files
haskell-gi-base.cabal view
@@ -1,5 +1,5 @@ name: haskell-gi-base-version: 0.18.4+version: 0.19 synopsis: Foundation for libraries generated by haskell-gi description: Foundation for libraries generated by haskell-gi homepage: https://github.com/haskell-gi/haskell-gi-base
src/Data/GI/Base/ManagedPtr.hs view
@@ -61,7 +61,7 @@ #if MIN_VERSION_base(4,9,0) import GHC.Stack (HasCallStack)-#elif MIN_VERSION_base(4,8,0)+#elif MIN_VERSION_base(4,8,1) import GHC.Stack (CallStack) import GHC.Exts (Constraint) type HasCallStack = ((?callStack :: CallStack) :: Constraint)
src/Data/GI/Base/Utils.hsc view
@@ -9,6 +9,7 @@ , mapSecond , mapSecondA , convertIfNonNull+ , convertFunPtrIfNonNull , callocBytes , callocBoxedBytes , callocMem@@ -38,7 +39,7 @@ import Foreign (peek) import Foreign.C.Types (CSize(..))-import Foreign.Ptr (Ptr, nullPtr, FunPtr, freeHaskellFunPtr)+import Foreign.Ptr (Ptr, nullPtr, FunPtr, nullFunPtr, freeHaskellFunPtr) import Foreign.Storable (Storable(..)) import Data.GI.Base.BasicTypes (GType(..), CGType, BoxedObject(..),@@ -90,6 +91,13 @@ convertIfNonNull ptr convert = if ptr == nullPtr then return Nothing else Just <$> convert ptr++-- | Apply the given conversion action to the given function pointer+-- if it is non-NULL, otherwise return `Nothing`.+convertFunPtrIfNonNull :: FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)+convertFunPtrIfNonNull ptr convert = if ptr == nullFunPtr+ then return Nothing+ else Just <$> convert ptr foreign import ccall "g_malloc0" g_malloc0 :: #{type gsize} -> IO (Ptr a)