Closed ocharles closed 1 year ago
What do you think about adding
unlift :: MonadUnliftIO m => (IO a -> IO b) -> m a -> m b unlift m x = do runInIO <- askRunInIO liftIO $ m $ runInIO x
to Control.Monad.IO.Unlift? This is handy when you have a IO a -> IO b, and avoids a little bit of boilerplate.
Control.Monad.IO.Unlift
IO a -> IO b
Usage example:
runSTControl lock stControl prepare = maybe (throwIO Locked) return =<< unlift (withLockTry lock) do
where withLockTry is withLockTry :: Lock -> IO a -> IO (Maybe a) from extra.
withLockTry
withLockTry :: Lock -> IO a -> IO (Maybe a)
extra
Seems reasonable to me!
What do you think about adding
to
Control.Monad.IO.Unlift
? This is handy when you have aIO a -> IO b
, and avoids a little bit of boilerplate.Usage example:
where
withLockTry
iswithLockTry :: Lock -> IO a -> IO (Maybe a)
fromextra
.