{-# LANGUAGE Safe #-}
module Control.Concurrent.Thread.Utils(
runInThread
)
where
import safe Control.Concurrent ( forkIO, ThreadId )
runInThread :: IO a -> (a -> IO b) -> IO ThreadId
runInThread :: forall a b. IO a -> (a -> IO b) -> IO ThreadId
runInThread IO a
action a -> IO b
callback = IO () -> IO ThreadId
forkIO (IO () -> IO ThreadId) -> IO () -> IO ThreadId
forall a b. (a -> b) -> a -> b
$ IO a
action IO a -> (a -> IO b) -> IO b
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= a -> IO b
callback IO b -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()