module Control.Concurrent.Async.Lifted.Safe.Utils ( allocateAsync, allocateLinkedAsync ) where import ClassyPrelude hiding (cancel) import Control.Lens import Control.Concurrent.Async.Lifted.Safe import Control.Monad.Trans.Resource allocateLinkedAsync, allocateAsync :: forall m a. MonadResource m => IO a -> m (Async a) allocateAsync = fmap (view _2) . flip allocate cancel . async allocateLinkedAsync = uncurry (<$) . (id &&& link) <=< allocateAsync