1
0
mirror of https://github.com/tensorflow/haskell.git synced 2024-06-02 11:03:34 +02:00

Get rid of some liftIO's

This commit is contained in:
Jeroen Bransen 2017-10-02 20:42:07 +02:00
parent 1347f01f7c
commit 121c20b6bb

View File

@ -91,11 +91,11 @@ withSession optionSetter action = do
-- Collects all runners before deleting the session.
mapM_ shutDownRunner runners
checkStatus (Raw.deleteSession s)
bracket (liftIO $ Raw.newSessionOptions) (liftIO . Raw.deleteSessionOptions) $ \options -> do
liftIO $ optionSetter options
bracket
(liftIO $ checkStatus (Raw.newSession options))
(liftIO . cleanup)
let bracketIO x y = bracket (liftIO x) (liftIO . y)
bracketIO Raw.newSessionOptions Raw.deleteSessionOptions $ \options -> do
bracketIO
(optionSetter options >> checkStatus (Raw.newSession options))
cleanup
(action (asyncCollector drain))
asyncCollector :: MVar [Async ()] -> IO () -> IO ()