haskell-gi-base 0.18.2 → 0.18.3
raw patch · 2 files changed
+16/−2 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.GI.Base.ManagedPtr: unsafeCastTo :: forall o o'. (GObject o, GObject o') => (ForeignPtr o' -> o') -> o -> IO o'
+ Data.GI.Base.ManagedPtr: unsafeCastTo :: forall o o'. (HasCallStack, GObject o, GObject o') => (ForeignPtr o' -> o') -> o -> IO o'
Files
- haskell-gi-base.cabal +1/−1
- src/Data/GI/Base/ManagedPtr.hs +15/−1
haskell-gi-base.cabal view
@@ -1,5 +1,5 @@ name: haskell-gi-base-version: 0.18.2+version: 0.18.3 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
@@ -1,4 +1,7 @@ {-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}+-- For HasCallStack compatibility+{-# LANGUAGE ImplicitParams, KindSignatures, ConstraintKinds #-}+ -- | We wrap most objects in a "managed pointer", which is simply a -- newtype for a 'ForeignPtr' of the appropriate type: --@@ -55,6 +58,17 @@ import Data.GI.Base.BasicTypes import Data.GI.Base.Utils +#if MIN_VERSION_base(4,9,0)+import GHC.Stack (HasCallStack)+#elif MIN_VERSION_base(4,8,0)+import GHC.Stack (CallStack)+import GHC.Exts (Constraint)+type HasCallStack = ((?callStack :: CallStack) :: Constraint)+#else+import GHC.Exts (Constraint)+type HasCallStack = (() :: Constraint)+#endif+ -- | Perform an IO action on the 'Ptr' inside a managed pointer. withManagedPtr :: ForeignPtrNewtype a => a -> (Ptr a -> IO c) -> IO c withManagedPtr managed action = do@@ -123,7 +137,7 @@ -- | Cast to the given type, assuming that the cast will succeed. This -- function will call `error` if the cast is illegal.-unsafeCastTo :: forall o o'. (GObject o, GObject o') =>+unsafeCastTo :: forall o o'. (HasCallStack, GObject o, GObject o') => (ForeignPtr o' -> o') -> o -> IO o' unsafeCastTo constructor obj = withManagedPtr obj $ \objPtr -> do