From 809e77928b69c489681f17599350b4c04323514b Mon Sep 17 00:00:00 2001 From: panne Date: Wed, 29 Jan 2003 07:54:46 +0000 Subject: [PATCH] [project @ 2003-01-29 07:54:46 by panne] Ooops, unbreak non-GHC targets... --- Foreign/Marshal/Pool.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Foreign/Marshal/Pool.hs b/Foreign/Marshal/Pool.hs index 2b0664f..1b1ac1c 100644 --- a/Foreign/Marshal/Pool.hs +++ b/Foreign/Marshal/Pool.hs @@ -44,12 +44,6 @@ module Foreign.Marshal.Pool ( pooledNewArray0 -- :: Storable a => Pool -> a -> [a] -> IO (Ptr a) ) where -#if defined(__NHC__) -import IO ( bracket ) -#elif defined(__HUGS__) -import Control.Exception ( bracket ) -#endif - #ifdef __GLASGOW_HASKELL__ import GHC.Base ( Int, Monad(..), (.), not, map ) import GHC.Err ( undefined ) @@ -59,6 +53,11 @@ import GHC.List ( elem, length ) import GHC.Num ( Num(..) ) #else import Data.IORef ( IORef, newIORef, readIORef, modifyIORef ) +#if defined(__NHC__) +import IO ( bracket ) +#else +import Control.Exception ( bracket ) +#endif #endif import Control.Monad ( liftM ) @@ -95,6 +94,7 @@ freePool (Pool pool) = readIORef pool >>= freeAll -- deallocated (including its contents) after the action has finished. withPool :: (Pool -> IO b) -> IO b +#ifdef __GLASGOW_HASKELL__ withPool act = -- ATTENTION: cut-n-paste from Control.Exception below! block (do pool <- newPool @@ -103,6 +103,9 @@ withPool act = -- ATTENTION: cut-n-paste from Control.Exception below! (\e -> do freePool pool; throw e) freePool pool return val) +#else +withPool = bracket newPool freePool +#endif -------------------------------------------------------------------------------- -- 1.7.10.4