diff options
Diffstat (limited to 'src/runtime/haskell-bind/Gu.hsc')
| -rw-r--r-- | src/runtime/haskell-bind/Gu.hsc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/runtime/haskell-bind/Gu.hsc b/src/runtime/haskell-bind/Gu.hsc index e9d060c92..20a728c79 100644 --- a/src/runtime/haskell-bind/Gu.hsc +++ b/src/runtime/haskell-bind/Gu.hsc @@ -9,6 +9,7 @@ import Foreign import Foreign.C import Foreign.C.String import Foreign.Ptr +import Control.Exception data GuEnum @@ -117,6 +118,10 @@ ptrToList appl arity = do let ptr = appl `plusPtr` (#offset PgfApplication, args) --args is not an argument, it's the actual field name sequence [peek (ptr `plusPtr` (i * (#size PgfExpr))) | i<-[0..arity-1]] - - +withGuPool :: (Ptr GuPool -> IO a) -> IO a +withGuPool f = do + pl <- gu_new_pool + f pl `finally` gu_pool_free pl + -- for true haskell persons + -- withGuPool f = bracket gu_new_pool gu_pool_free f |
