never executed always true always false
1 {-# language CPP #-}
2
3 #ifndef ENABLE_INTERNAL_DOCUMENTATION
4 {-# OPTIONS_HADDOCK hide #-}
5 #endif
6
7 module OpenCV.Internal
8 ( objFromPtr
9 ) where
10
11 import "base" Control.Exception ( mask_ )
12 import "base" Foreign.Concurrent ( newForeignPtr )
13 import "base" Foreign.ForeignPtr ( ForeignPtr )
14 import "base" Foreign.Ptr ( Ptr )
15
16 objFromPtr :: (ForeignPtr c -> hask) -> (Ptr c -> IO ()) -> IO (Ptr c) -> IO hask
17 objFromPtr haskCons finalizer mkObjPtr = mask_ $ do
18 objPtr <- mkObjPtr
19 haskCons <$> newForeignPtr objPtr (finalizer objPtr)