-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)
--   
--   Please see the documentation and README at
--   https://www.stackage.org/package/unliftio
@package unliftio
@version 0.2.13

-- | Lifted Control.Concurrent.Chan.
module UnliftIO.Chan
data Chan a

-- | Lifted newChan.
newChan :: MonadIO m => m (Chan a)

-- | Lifted writeChan.
writeChan :: MonadIO m => Chan a -> a -> m ()

-- | Lifted readChan.
readChan :: MonadIO m => Chan a -> m a

-- | Lifted dupChan.
dupChan :: MonadIO m => Chan a -> m (Chan a)

-- | Lifted getChanContents.
getChanContents :: MonadIO m => Chan a -> m [a]

-- | Lifted writeList2Chan.
writeList2Chan :: MonadIO m => Chan a -> [a] -> m ()

-- | Unlifted System.Directory.
module UnliftIO.Directory

-- | Lifted createDirectory.
createDirectory :: MonadIO m => FilePath -> m ()

-- | Lifted createDirectoryIfMissing.
createDirectoryIfMissing :: MonadIO m => Bool -> FilePath -> m ()

-- | Lifted removeDirectory.
removeDirectory :: MonadIO m => FilePath -> m ()

-- | Lifted removeDirectoryRecursive.
removeDirectoryRecursive :: MonadIO m => FilePath -> m ()

-- | Lifted removePathForcibly.
removePathForcibly :: MonadIO m => FilePath -> m ()

-- | Lifted renameDirectory.
renameDirectory :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted listDirectory.
listDirectory :: MonadIO m => FilePath -> m [FilePath]

-- | Lifted getDirectoryContents.
getDirectoryContents :: MonadIO m => FilePath -> m [FilePath]

-- | Lifted getCurrentDirectory.
getCurrentDirectory :: MonadIO m => m FilePath

-- | Lifted setCurrentDirectory.
setCurrentDirectory :: MonadIO m => FilePath -> m ()

-- | Unlifted withCurrentDirectory.
withCurrentDirectory :: MonadUnliftIO m => FilePath -> m a -> m a

-- | Lifted getHomeDirectory.
getHomeDirectory :: MonadIO m => m FilePath
data XdgDirectory
XdgData :: XdgDirectory
XdgConfig :: XdgDirectory
XdgCache :: XdgDirectory

-- | Lifted getXdgDirectory.
getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath

-- | Lifted getAppUserDataDirectory.
getAppUserDataDirectory :: MonadIO m => FilePath -> m FilePath

-- | Lifted getUserDocumentsDirectory.
getUserDocumentsDirectory :: MonadIO m => m FilePath

-- | Lifted getTemporaryDirectory.
getTemporaryDirectory :: MonadIO m => m FilePath

-- | Lifted removeFile.
removeFile :: MonadIO m => FilePath -> m ()

-- | Lifted renameFile.
renameFile :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted renamePath.
renamePath :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted copyFile.
copyFile :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted copyFileWithMetadata.
copyFileWithMetadata :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted canonicalizePath.
canonicalizePath :: MonadIO m => FilePath -> m FilePath

-- | Lifted makeAbsolute.
makeAbsolute :: MonadIO m => FilePath -> m FilePath

-- | Lifted makeRelativeToCurrentDirectory.
makeRelativeToCurrentDirectory :: MonadIO m => FilePath -> m FilePath

-- | Lifted findExecutable.
findExecutable :: MonadIO m => String -> m (Maybe FilePath)

-- | Lifted findExecutables.
findExecutables :: MonadIO m => String -> m [FilePath]

-- | Lifted findExecutablesInDirectories.
findExecutablesInDirectories :: MonadIO m => [FilePath] -> String -> m [FilePath]

-- | Lifted findFile.
findFile :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath)

-- | Lifted findFiles.
findFiles :: MonadIO m => [FilePath] -> String -> m [FilePath]

-- | Unlifted findFileWith.
findFileWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m (Maybe FilePath)

-- | Unlifted findFilesWith.
findFilesWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m [FilePath]
exeExtension :: String

-- | Lifted getFileSize.
getFileSize :: MonadIO m => FilePath -> m Integer

-- | Lifted doesPathExist.
doesPathExist :: MonadIO m => FilePath -> m Bool

-- | Lifted doesFileExist.
doesFileExist :: MonadIO m => FilePath -> m Bool

-- | Lifted doesDirectoryExist.
doesDirectoryExist :: MonadIO m => FilePath -> m Bool

-- | Lifted pathIsSymbolicLink.
pathIsSymbolicLink :: MonadIO m => FilePath -> m Bool
data Permissions
emptyPermissions :: Permissions
readable :: Permissions -> Bool
writable :: Permissions -> Bool
executable :: Permissions -> Bool
searchable :: Permissions -> Bool
setOwnerReadable :: Bool -> Permissions -> Permissions
setOwnerWritable :: Bool -> Permissions -> Permissions
setOwnerExecutable :: Bool -> Permissions -> Permissions
setOwnerSearchable :: Bool -> Permissions -> Permissions

-- | Lifted getPermissions.
getPermissions :: MonadIO m => FilePath -> m Permissions

-- | Lifted setPermissions.
setPermissions :: MonadIO m => FilePath -> Permissions -> m ()

-- | Lifted copyPermissions.
copyPermissions :: MonadIO m => FilePath -> FilePath -> m ()

-- | Lifted getAccessTime.
getAccessTime :: MonadIO m => FilePath -> m UTCTime

-- | Lifted getModificationTime.
getModificationTime :: MonadIO m => FilePath -> m UTCTime

-- | Lifted setAccessTime.
setAccessTime :: MonadIO m => FilePath -> UTCTime -> m ()

-- | Lifted setModificationTime.
setModificationTime :: MonadIO m => FilePath -> UTCTime -> m ()

-- | Unlifted System.Environment.
module UnliftIO.Environment

-- | Lifted getArgs.
getArgs :: MonadIO m => m [String]

-- | Lifted getProgName.
getProgName :: MonadIO m => m String

-- | Lifted getExecutablePath.
getExecutablePath :: MonadIO m => m FilePath

-- | Lifted getEnv.
getEnv :: MonadIO m => String -> m String

-- | Lifted lookupEnv.
lookupEnv :: MonadIO m => String -> m (Maybe String)

-- | Lifted setEnv.
setEnv :: MonadIO m => String -> String -> m ()

-- | Lifted unsetEnv.
unsetEnv :: MonadIO m => String -> m ()

-- | Unlifted withArgs.
withArgs :: MonadUnliftIO m => [String] -> m a -> m a

-- | Unlifted withProgName.
withProgName :: MonadUnliftIO m => String -> m a -> m a

-- | Lifted getEnvironment.
getEnvironment :: MonadIO m => m [(String, String)]

-- | Unlifted Control.Exception, with extra async exception safety
--   and more helper functions.
--   
--   This module works best when your cleanup functions adhere to certain
--   expectations around exception safety and interruptible actions. For
--   more details, see this exception safety tutorial.
module UnliftIO.Exception

-- | Synchronously throw the given exception.
throwIO :: (MonadIO m, Exception e) => e -> m a

-- | A convenience function for throwing a user error. This is useful for
--   cases where it would be too high a burden to define your own exception
--   type.
--   
--   This throws an exception of type StringException. When GHC
--   supports it (base 4.9 and GHC 8.0 and onward), it includes a call
--   stack.
throwString :: (MonadIO m, HasCallStack) => String -> m a

-- | Exception type thrown by throwString.
--   
--   Note that the second field of the data constructor depends on GHC/base
--   version. For base 4.9 and GHC 8.0 and later, the second field is a
--   call stack. Previous versions of GHC and base do not support call
--   stacks, and the field is simply unit (provided to make pattern
--   matching across GHC versions easier).
data StringException
StringException :: String -> CallStack -> StringException

-- | Smart constructor for a StringException that deals with the
--   call stack.
stringException :: HasCallStack => String -> StringException

-- | Throw an asynchronous exception to another thread.
--   
--   Synchronously typed exceptions will be wrapped into an
--   AsyncExceptionWrapper, see
--   https://github.com/fpco/safe-exceptions#determining-sync-vs-async.
--   
--   It's usually a better idea to use the UnliftIO.Async module,
--   see https://github.com/fpco/safe-exceptions#quickstart.
throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m ()

-- | Generate a pure value which, when forced, will synchronously throw the
--   given exception.
--   
--   Generally it's better to avoid using this function and instead use
--   throwIO, see
--   https://github.com/fpco/safe-exceptions#quickstart.
impureThrow :: Exception e => e -> a

-- | Unwrap an Either value, throwing its Left value as a
--   runtime exception via throwIO if present.
fromEither :: (Exception e, MonadIO m) => Either e a -> m a

-- | Same as fromEither, but works on an IO-wrapped
--   Either.
fromEitherIO :: (Exception e, MonadIO m) => IO (Either e a) -> m a

-- | Same as fromEither, but works on an m-wrapped
--   Either.
fromEitherM :: (Exception e, MonadIO m) => m (Either e a) -> m a

-- | Unlifted catch, but will not catch asynchronous exceptions.
catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a

-- | catch specialized to only catching IOExceptions.
catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a

-- | catch specialized to catch all synchronous exception.
catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a

-- | Same as catch, but fully force evaluation of the result value
--   to find all impure exceptions.
catchDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a

-- | catchDeep specialized to catch all synchronous exception.
catchAnyDeep :: (NFData a, MonadUnliftIO m) => m a -> (SomeException -> m a) -> m a

-- | catchJust is like catch but it takes an extra argument
--   which is an exception predicate, a function which selects which type
--   of exceptions we're interested in.
catchJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a

-- | Flipped version of catch.
handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a

-- | handle specialized to only catching IOExceptions.
handleIO :: MonadUnliftIO m => (IOException -> m a) -> m a -> m a

-- | Flipped version of catchAny.
handleAny :: MonadUnliftIO m => (SomeException -> m a) -> m a -> m a

-- | Flipped version of catchDeep.
handleDeep :: (MonadUnliftIO m, Exception e, NFData a) => (e -> m a) -> m a -> m a

-- | Flipped version of catchAnyDeep.
handleAnyDeep :: (MonadUnliftIO m, NFData a) => (SomeException -> m a) -> m a -> m a

-- | Flipped catchJust.
handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a

-- | Unlifted try, but will not catch asynchronous exceptions.
try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a)

-- | try specialized to only catching IOExceptions.
tryIO :: MonadUnliftIO m => m a -> m (Either IOException a)

-- | try specialized to catch all synchronous exceptions.
tryAny :: MonadUnliftIO m => m a -> m (Either SomeException a)

-- | Same as try, but fully force evaluation of the result value to
--   find all impure exceptions.
tryDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> m (Either e a)

-- | tryDeep specialized to catch all synchronous exceptions.
tryAnyDeep :: (MonadUnliftIO m, NFData a) => m a -> m (Either SomeException a)

-- | A variant of try that takes an exception predicate to select
--   which exceptions are caught.
tryJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a)

-- | Evaluate the value to WHNF and catch any synchronous exceptions.
--   
--   The expression may still have bottom values within it; you may instead
--   want to use pureTryDeep.
pureTry :: a -> Either SomeException a

-- | Evaluate the value to NF and catch any synchronous exceptions.
pureTryDeep :: NFData a => a -> Either SomeException a

-- | Generalized version of Handler.
data Handler m a
Handler :: (e -> m a) -> Handler m a

-- | Same as upstream catches, but will not catch asynchronous
--   exceptions.
catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a

-- | Same as catches, but fully force evaluation of the result value
--   to find all impure exceptions.
catchesDeep :: (MonadUnliftIO m, NFData a) => m a -> [Handler m a] -> m a

-- | Async safe version of onException.
onException :: MonadUnliftIO m => m a -> m b -> m a

-- | Async safe version of bracket.
bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c

-- | Async safe version of bracket_.
bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c

-- | Async safe version of finally.
finally :: MonadUnliftIO m => m a -> m b -> m a

-- | Like onException, but provides the handler the thrown
--   exception.
withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a

-- | Async safe version of bracketOnError.
bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c

-- | A variant of bracketOnError where the return value from the
--   first computation is not required.
bracketOnError_ :: MonadUnliftIO m => m a -> m b -> m c -> m c

-- | Wrap up an asynchronous exception to be treated as a synchronous
--   exception.
--   
--   This is intended to be created via toSyncException.
data SyncExceptionWrapper
SyncExceptionWrapper :: e -> SyncExceptionWrapper

-- | Convert an exception into a synchronous exception.
--   
--   For synchronous exceptions, this is the same as toException.
--   For asynchronous exceptions, this will wrap up the exception with
--   SyncExceptionWrapper.
toSyncException :: Exception e => e -> SomeException

-- | Wrap up a synchronous exception to be treated as an asynchronous
--   exception.
--   
--   This is intended to be created via toAsyncException.
data AsyncExceptionWrapper
AsyncExceptionWrapper :: e -> AsyncExceptionWrapper

-- | Convert an exception into an asynchronous exception.
--   
--   For asynchronous exceptions, this is the same as toException.
--   For synchronous exceptions, this will wrap up the exception with
--   AsyncExceptionWrapper.
toAsyncException :: Exception e => e -> SomeException

-- | Check if the given exception is synchronous.
isSyncException :: Exception e => e -> Bool

-- | Check if the given exception is asynchronous.
isAsyncException :: Exception e => e -> Bool

-- | Unlifted version of mask.
mask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b

-- | Unlifted version of uninterruptibleMask.
uninterruptibleMask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b

-- | Unlifted version of mask_.
mask_ :: MonadUnliftIO m => m a -> m a

-- | Unlifted version of uninterruptibleMask_.
uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a

-- | Lifted version of evaluate.
evaluate :: MonadIO m => a -> m a

-- | Deeply evaluate a value using evaluate and NFData.
evaluateDeep :: (MonadIO m, NFData a) => a -> m a
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
displayException :: Exception e => e -> String
class Typeable (a :: k)
data SomeException
SomeException :: e -> SomeException
data SomeAsyncException
SomeAsyncException :: e -> SomeAsyncException
data IOException
assert :: Bool -> a -> a
instance GHC.Show.Show UnliftIO.Exception.StringException
instance GHC.Exception.Type.Exception UnliftIO.Exception.StringException
instance GHC.Show.Show UnliftIO.Exception.AsyncExceptionWrapper
instance GHC.Exception.Type.Exception UnliftIO.Exception.AsyncExceptionWrapper
instance GHC.Show.Show UnliftIO.Exception.SyncExceptionWrapper
instance GHC.Exception.Type.Exception UnliftIO.Exception.SyncExceptionWrapper

-- | Unlifted Foreign.
module UnliftIO.Foreign
type CString = Ptr CChar
type CStringLen = (Ptr CChar, Int)

-- | Lifted peekCString.
peekCString :: MonadIO m => CString -> m String

-- | Lifted peekCStringLen.
peekCStringLen :: MonadIO m => CStringLen -> m String

-- | Lifted newCString.
newCString :: MonadIO m => String -> m CString

-- | Lifted newCStringLen.
newCStringLen :: MonadIO m => String -> m CStringLen

-- | Unlifted withCString.
withCString :: MonadUnliftIO m => String -> (CString -> m a) -> m a

-- | Unlifted withCStringLen.
withCStringLen :: MonadUnliftIO m => String -> (CStringLen -> m a) -> m a
charIsRepresentable :: Char -> IO Bool
castCharToCChar :: Char -> CChar
castCCharToChar :: CChar -> Char
castCharToCUChar :: Char -> CUChar
castCUCharToChar :: CUChar -> Char
castCharToCSChar :: Char -> CSChar
castCSCharToChar :: CSChar -> Char

-- | Lifted peekCAString.
peekCAString :: MonadIO m => CString -> m String

-- | Lifted peekCAStringLen.
peekCAStringLen :: MonadIO m => CStringLen -> m String

-- | Lifted newCAString.
newCAString :: MonadIO m => String -> m CString

-- | Lifted newCAStringLen.
newCAStringLen :: MonadIO m => String -> m CStringLen

-- | Unlifted withCAString.
withCAString :: MonadUnliftIO m => String -> (CString -> m a) -> m a

-- | Unlifted withCAStringLen.
withCAStringLen :: MonadUnliftIO m => String -> (CStringLen -> m a) -> m a
type CWString = Ptr CWchar
type CWStringLen = (Ptr CWchar, Int)

-- | Lifted peekCWString.
peekCWString :: MonadIO m => CWString -> m String

-- | Lifted peekCWStringLen.
peekCWStringLen :: MonadIO m => CWStringLen -> m String

-- | Lifted newCWString.
newCWString :: MonadIO m => String -> m CWString

-- | Lifted newCWStringLen.
newCWStringLen :: MonadIO m => String -> m CWStringLen

-- | Unlifted withCWString.
withCWString :: MonadUnliftIO m => String -> (CWString -> m a) -> m a

-- | Unlifted withCWStringLen.
withCWStringLen :: MonadUnliftIO m => String -> (CWStringLen -> m a) -> m a
newtype Errno
Errno :: CInt -> Errno
eOK :: Errno
e2BIG :: Errno
eACCES :: Errno
eADDRINUSE :: Errno
eADDRNOTAVAIL :: Errno
eADV :: Errno
eAFNOSUPPORT :: Errno
eAGAIN :: Errno
eALREADY :: Errno
eBADF :: Errno
eBADMSG :: Errno
eBADRPC :: Errno
eBUSY :: Errno
eCHILD :: Errno
eCOMM :: Errno
eCONNABORTED :: Errno
eCONNREFUSED :: Errno
eCONNRESET :: Errno
eDEADLK :: Errno
eDESTADDRREQ :: Errno
eDIRTY :: Errno
eDOM :: Errno
eDQUOT :: Errno
eEXIST :: Errno
eFAULT :: Errno
eFBIG :: Errno
eFTYPE :: Errno
eHOSTDOWN :: Errno
eHOSTUNREACH :: Errno
eIDRM :: Errno
eILSEQ :: Errno
eINPROGRESS :: Errno
eINTR :: Errno
eINVAL :: Errno
eIO :: Errno
eISCONN :: Errno
eISDIR :: Errno
eLOOP :: Errno
eMFILE :: Errno
eMLINK :: Errno
eMSGSIZE :: Errno
eMULTIHOP :: Errno
eNAMETOOLONG :: Errno
eNETDOWN :: Errno
eNETRESET :: Errno
eNETUNREACH :: Errno
eNFILE :: Errno
eNOBUFS :: Errno
eNODATA :: Errno
eNODEV :: Errno
eNOENT :: Errno
eNOEXEC :: Errno
eNOLCK :: Errno
eNOLINK :: Errno
eNOMEM :: Errno
eNOMSG :: Errno
eNONET :: Errno
eNOPROTOOPT :: Errno
eNOSPC :: Errno
eNOSR :: Errno
eNOSTR :: Errno
eNOSYS :: Errno
eNOTBLK :: Errno
eNOTCONN :: Errno
eNOTDIR :: Errno
eNOTEMPTY :: Errno
eNOTSOCK :: Errno
eNOTSUP :: Errno
eNOTTY :: Errno
eNXIO :: Errno
eOPNOTSUPP :: Errno
ePERM :: Errno
ePFNOSUPPORT :: Errno
ePIPE :: Errno
ePROCLIM :: Errno
ePROCUNAVAIL :: Errno
ePROGMISMATCH :: Errno
ePROGUNAVAIL :: Errno
ePROTO :: Errno
ePROTONOSUPPORT :: Errno
ePROTOTYPE :: Errno
eRANGE :: Errno
eREMCHG :: Errno
eREMOTE :: Errno
eROFS :: Errno
eRPCMISMATCH :: Errno
eRREMOTE :: Errno
eSHUTDOWN :: Errno
eSOCKTNOSUPPORT :: Errno
eSPIPE :: Errno
eSRCH :: Errno
eSRMNT :: Errno
eSTALE :: Errno
eTIME :: Errno
eTIMEDOUT :: Errno
eTOOMANYREFS :: Errno
eTXTBSY :: Errno
eUSERS :: Errno
eWOULDBLOCK :: Errno
eXDEV :: Errno
isValidErrno :: Errno -> Bool

-- | Lifted getErrno.
getErrno :: MonadIO m => m Errno

-- | Lifted resetErrno.
resetErrno :: MonadIO m => m ()
errnoToIOError :: String -> Errno -> Maybe Handle -> Maybe String -> IOError

-- | Lifted throwErrno.
throwErrno :: MonadIO m => String -> m a

-- | Unlifted throwErrnoIf.
throwErrnoIf :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m a

-- | Unlifted throwErrnoIf_.
throwErrnoIf_ :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m ()

-- | Unlifted throwErrnoIfRetry.
throwErrnoIfRetry :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m a

-- | Unlifted throwErrnoIfRetry_.
throwErrnoIfRetry_ :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m ()

-- | Unlifted throwErrnoIfMinus1.
throwErrnoIfMinus1 :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m a

-- | Unlifted throwErrnoIfMinus1_
throwErrnoIfMinus1_ :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m ()

-- | Unlifted throwErrnoIfMinus1Retry.
throwErrnoIfMinus1Retry :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m a

-- | Unlifted throwErrnoIfMinus1Retry_.
throwErrnoIfMinus1Retry_ :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m ()

-- | Unlifted throwErrnoIfNull.
throwErrnoIfNull :: MonadUnliftIO m => String -> m (Ptr a) -> m (Ptr a)

-- | Unlifted throwErrnoIfNullRetry.
throwErrnoIfNullRetry :: MonadUnliftIO m => String -> m (Ptr a) -> m (Ptr a)

-- | Unlifted throwErrnoIfRetryMayBlock.
throwErrnoIfRetryMayBlock :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m b -> m a

-- | Unlifted throwErrnoIfRetryMayBlock_.
throwErrnoIfRetryMayBlock_ :: MonadUnliftIO m => (a -> Bool) -> String -> m a -> m b -> m ()

-- | Unlifted throwErrnoIfMinus1RetryMayBlock.
throwErrnoIfMinus1RetryMayBlock :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m b -> m a

-- | Unlifted throwErrnoIfMinus1RetryMayBlock_
throwErrnoIfMinus1RetryMayBlock_ :: (MonadUnliftIO m, Eq a, Num a) => String -> m a -> m b -> m ()

-- | Unlifted throwErrnoIfNullRetryMayBlock.
throwErrnoIfNullRetryMayBlock :: MonadUnliftIO m => String -> m (Ptr a) -> m b -> m (Ptr a)

-- | Lifted throwErrnoPath.
throwErrnoPath :: MonadIO m => String -> FilePath -> m a

-- | Unlifted throwErrnoPathIf.
throwErrnoPathIf :: MonadUnliftIO m => (a -> Bool) -> String -> FilePath -> m a -> m a

-- | Unlifted throwErrnoPathIf_.
throwErrnoPathIf_ :: MonadUnliftIO m => (a -> Bool) -> String -> FilePath -> m a -> m ()

-- | Unlifted throwErrnoPathIfNull.
throwErrnoPathIfNull :: MonadUnliftIO m => String -> FilePath -> m (Ptr a) -> m (Ptr a)

-- | Unlifted throwErrnoPathIfMinus1.
throwErrnoPathIfMinus1 :: (MonadUnliftIO m, Eq a, Num a) => String -> FilePath -> m a -> m a

-- | Unlifted throwErrnoPathIfMinus1_.
throwErrnoPathIfMinus1_ :: (MonadUnliftIO m, Eq a, Num a) => String -> FilePath -> m a -> m ()
data Ptr a
nullPtr :: Ptr a
castPtr :: Ptr a -> Ptr b
plusPtr :: Ptr a -> Int -> Ptr b
alignPtr :: Ptr a -> Int -> Ptr a
minusPtr :: Ptr a -> Ptr b -> Int
data FunPtr a
nullFunPtr :: FunPtr a
castFunPtr :: FunPtr a -> FunPtr b
castFunPtrToPtr :: FunPtr a -> Ptr b
castPtrToFunPtr :: Ptr a -> FunPtr b

-- | Lifted freeHaskellFunPtr.
freeHaskellFunPtr :: MonadIO m => FunPtr a -> m ()
newtype IntPtr
IntPtr :: Int -> IntPtr
ptrToIntPtr :: Ptr a -> IntPtr
intPtrToPtr :: IntPtr -> Ptr a
newtype WordPtr
WordPtr :: Word -> WordPtr
ptrToWordPtr :: Ptr a -> WordPtr
wordPtrToPtr :: WordPtr -> Ptr a
data ForeignPtr a
type FinalizerPtr a = FunPtr Ptr a -> IO ()
type FinalizerEnvPtr env a = FunPtr Ptr env -> Ptr a -> IO ()

-- | Lifted newForeignPtr.
newForeignPtr :: MonadIO m => FinalizerPtr a -> Ptr a -> m (ForeignPtr a)

-- | Lifted newForeignPtr_.
newForeignPtr_ :: MonadIO m => Ptr a -> m (ForeignPtr a)

-- | Lifted addForeignPtrFinalizer.
addForeignPtrFinalizer :: MonadIO m => FinalizerPtr a -> ForeignPtr a -> m ()

-- | Lifted newForeignPtrEnv.
newForeignPtrEnv :: MonadIO m => FinalizerEnvPtr env a -> Ptr env -> Ptr a -> m (ForeignPtr a)

-- | Lifted addForeignPtrFinalizerEnv.
addForeignPtrFinalizerEnv :: MonadIO m => FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> m ()

-- | Unlifted withForeignPtr.
withForeignPtr :: MonadUnliftIO m => ForeignPtr a -> (Ptr a -> m b) -> m b

-- | Lifted finalizeForeignPtr.
finalizeForeignPtr :: MonadIO m => ForeignPtr a -> m ()

-- | Lifted touchForeignPtr.
touchForeignPtr :: MonadIO m => ForeignPtr a -> m ()
castForeignPtr :: ForeignPtr a -> ForeignPtr b
plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b

-- | Lifted mallocForeignPtr.
mallocForeignPtr :: (MonadIO m, Storable a) => m (ForeignPtr a)

-- | Lifted mallocForeignPtrBytes.
mallocForeignPtrBytes :: MonadIO m => Int -> m (ForeignPtr a)

-- | Lifted mallocForeignPtrArray.
mallocForeignPtrArray :: (MonadIO m, Storable a) => Int -> m (ForeignPtr a)

-- | Lifted mallocForeignPtrArray0.
mallocForeignPtrArray0 :: (MonadIO m, Storable a) => Int -> m (ForeignPtr a)

-- | Unlifted newForeignPtr.
newGHCForeignPtr :: MonadUnliftIO m => Ptr a -> m () -> m (ForeignPtr a)

-- | Unlifted addForeignPtrFinalizer.
addGHCForeignPtrFinalizer :: MonadUnliftIO m => ForeignPtr a -> m () -> m ()
unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a
data StablePtr a

-- | Lifted newStablePtr.
newStablePtr :: MonadIO m => a -> m (StablePtr a)

-- | Lifted deRefStablePtr.
deRefStablePtr :: MonadIO m => StablePtr a -> m a

-- | Lifted freeStablePtr.
freeStablePtr :: MonadIO m => StablePtr a -> m ()
castStablePtrToPtr :: StablePtr a -> Ptr ()
castPtrToStablePtr :: Ptr () -> StablePtr a
class Storable a
sizeOf :: Storable a => a -> Int
alignment :: Storable a => a -> Int
peekElemOff :: Storable a => Ptr a -> Int -> IO a
pokeElemOff :: Storable a => Ptr a -> Int -> a -> IO ()
peekByteOff :: Storable a => Ptr b -> Int -> IO a
pokeByteOff :: Storable a => Ptr b -> Int -> a -> IO ()
peek :: Storable a => Ptr a -> IO a
poke :: Storable a => Ptr a -> a -> IO ()

-- | Unlifted alloca.
alloca :: (MonadUnliftIO m, Storable a) => (Ptr a -> m b) -> m b

-- | Unlifted allocaBytes.
allocaBytes :: MonadUnliftIO m => Int -> (Ptr a -> m b) -> m b

-- | Unlifted allocaBytesAligned.
allocaBytesAligned :: MonadUnliftIO m => Int -> Int -> (Ptr a -> m b) -> m b

-- | Lifted malloc.
malloc :: (MonadIO m, Storable a) => m (Ptr a)

-- | Lifted mallocBytes.
mallocBytes :: MonadIO m => Int -> m (Ptr a)

-- | Lifted calloc.
calloc :: (MonadIO m, Storable a) => m (Ptr a)

-- | Lifted callocBytes.
callocBytes :: MonadIO m => Int -> m (Ptr a)

-- | Lifted realloc.
realloc :: (MonadIO m, Storable b) => Ptr a -> m (Ptr b)

-- | Lifted reallocBytes.
reallocBytes :: MonadIO m => Ptr a -> Int -> m (Ptr a)

-- | Lifted free.
free :: MonadIO m => Ptr a -> m ()
finalizerFree :: FinalizerPtr a

-- | Lifted mallocArray.
mallocArray :: (MonadIO m, Storable a) => Int -> m (Ptr a)

-- | Lifted mallocArray0.
mallocArray0 :: (MonadIO m, Storable a) => Int -> m (Ptr a)

-- | Unlifted allocaArray.
allocaArray :: (MonadUnliftIO m, Storable a) => Int -> (Ptr a -> m b) -> m b

-- | Unlifted allocaArray0.
allocaArray0 :: (MonadUnliftIO m, Storable a) => Int -> (Ptr a -> m b) -> m b

-- | Lifted reallocArray.
reallocArray :: (MonadIO m, Storable a) => Ptr a -> Int -> m (Ptr a)

-- | Lifted reallocArray0.
reallocArray0 :: (MonadIO m, Storable a) => Ptr a -> Int -> m (Ptr a)

-- | Lifted callocArray.
callocArray :: (MonadIO m, Storable a) => Int -> m (Ptr a)

-- | Lifted callocArray0.
callocArray0 :: (MonadIO m, Storable a) => Int -> m (Ptr a)

-- | Lifted peekArray.
peekArray :: (MonadIO m, Storable a) => Int -> Ptr a -> m [a]

-- | Lifted peekArray0.
peekArray0 :: (MonadIO m, Storable a, Eq a) => a -> Ptr a -> m [a]

-- | Lifted pokeArray.
pokeArray :: (MonadIO m, Storable a) => Ptr a -> [a] -> m ()

-- | Lifted pokeArray0.
pokeArray0 :: (MonadIO m, Storable a) => a -> Ptr a -> [a] -> m ()

-- | Lifted newArray.
newArray :: (MonadIO m, Storable a) => [a] -> m (Ptr a)

-- | Lifted newArray0
newArray0 :: (MonadIO m, Storable a) => a -> [a] -> m (Ptr a)

-- | Unlifted withArray.
withArray :: (MonadUnliftIO m, Storable a) => [a] -> (Ptr a -> m b) -> m b

-- | Unlifted withArray0.
withArray0 :: (MonadUnliftIO m, Storable a) => a -> [a] -> (Ptr a -> m b) -> m b

-- | Unlifted withArrayLen.
withArrayLen :: (MonadUnliftIO m, Storable a) => [a] -> (Int -> Ptr a -> m b) -> m b

-- | Unlifted withArrayLen0.
withArrayLen0 :: (MonadUnliftIO m, Storable a) => a -> [a] -> (Int -> Ptr a -> m b) -> m b

-- | Lifted copyArray.
copyArray :: (MonadIO m, Storable a) => Ptr a -> Ptr a -> Int -> m ()

-- | Lifted moveArray.
moveArray :: (MonadIO m, Storable a) => Ptr a -> Ptr a -> Int -> m ()

-- | Lifted lengthArray0.
lengthArray0 :: (MonadIO m, Storable a, Eq a) => a -> Ptr a -> m Int
advancePtr :: Storable a => Ptr a -> Int -> Ptr a

-- | Unlifted throwIf.
throwIf :: MonadUnliftIO m => (a -> Bool) -> (a -> String) -> m a -> m a

-- | Unlifted throwIf_.
throwIf_ :: MonadUnliftIO m => (a -> Bool) -> (a -> String) -> m a -> m ()

-- | Unlifted throwIfNeg.
throwIfNeg :: (MonadUnliftIO m, Ord a, Num a) => (a -> String) -> m a -> m a

-- | Unlifted throwIfNeg_.
throwIfNeg_ :: (MonadUnliftIO m, Ord a, Num a) => (a -> String) -> m a -> m ()

-- | Unlifted throwIfNull.
throwIfNull :: MonadUnliftIO m => String -> m (Ptr a) -> m (Ptr a)
data Pool

-- | Lifted newPool.
newPool :: MonadIO m => m Pool

-- | Lifted freePool.
freePool :: MonadIO m => Pool -> m ()

-- | Unlifted withPool.
withPool :: MonadUnliftIO m => (Pool -> m b) -> m b

-- | Lifted pooledMalloc.
pooledMalloc :: (MonadIO m, Storable a) => Pool -> m (Ptr a)

-- | Lifted pooledMallocBytes.
pooledMallocBytes :: MonadIO m => Pool -> Int -> m (Ptr a)

-- | Lifted pooledRealloc.
pooledRealloc :: (MonadIO m, Storable a) => Pool -> Ptr a -> m (Ptr a)

-- | Lifted pooledReallocBytes.
pooledReallocBytes :: MonadIO m => Pool -> Ptr a -> Int -> m (Ptr a)

-- | Lifted pooledMallocArray.
pooledMallocArray :: (MonadIO m, Storable a) => Pool -> Int -> m (Ptr a)

-- | Lifted pooledMallocArray0.
pooledMallocArray0 :: (MonadIO m, Storable a) => Pool -> Int -> m (Ptr a)

-- | Lifted pooledReallocArray.
pooledReallocArray :: (MonadIO m, Storable a) => Pool -> Ptr a -> Int -> m (Ptr a)

-- | Lifted pooledReallocArray0.
pooledReallocArray0 :: (MonadIO m, Storable a) => Pool -> Ptr a -> Int -> m (Ptr a)

-- | Lifted pooledNew.
pooledNew :: (MonadIO m, Storable a) => Pool -> a -> m (Ptr a)

-- | Lifted pooledNewArray.
pooledNewArray :: (MonadIO m, Storable a) => Pool -> [a] -> m (Ptr a)

-- | Lifted pooledNewArray0.
pooledNewArray0 :: (MonadIO m, Storable a) => Pool -> a -> [a] -> m (Ptr a)

-- | Unlifted with.
with :: (MonadUnliftIO m, Storable a) => a -> (Ptr a -> m b) -> m b

-- | Lifted new.
new :: (MonadIO m, Storable a) => a -> m (Ptr a)
fromBool :: Num a => Bool -> a
toBool :: (Eq a, Num a) => a -> Bool

-- | Lifted maybeNew.
maybeNew :: MonadIO m => (a -> m (Ptr b)) -> Maybe a -> m (Ptr b)

-- | Lifted maybeWith.
maybeWith :: MonadIO m => (a -> (Ptr b -> m c) -> m c) -> Maybe a -> (Ptr b -> m c) -> m c

-- | Unlifted maybePeek.
maybePeek :: MonadUnliftIO m => (Ptr a -> m b) -> Ptr a -> m (Maybe b)
withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res

-- | Lifted copyBytes.
copyBytes :: MonadIO m => Ptr a -> Ptr a -> Int -> m ()

-- | Lifted moveBytes.
moveBytes :: MonadIO m => Ptr a -> Ptr a -> Int -> m ()

-- | Lifted fillBytes.
fillBytes :: MonadIO m => Ptr a -> Word8 -> Int -> m ()

-- | Unlifted System.IO.
module UnliftIO.IO
data IOMode
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
ReadWriteMode :: IOMode
data Handle
stdin :: Handle
stdout :: Handle
stderr :: Handle

-- | Unlifted version of withFile.
withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Unlifted version of withBinaryFile.
withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Lifted version of hClose
hClose :: MonadIO m => Handle -> m ()

-- | Lifted version of hFlush
hFlush :: MonadIO m => Handle -> m ()

-- | Lifted version of hFileSize
hFileSize :: MonadIO m => Handle -> m Integer

-- | Lifted version of hSetFileSize
hSetFileSize :: MonadIO m => Handle -> Integer -> m ()

-- | Lifted version of hIsEOF
hIsEOF :: MonadIO m => Handle -> m Bool
data BufferMode
NoBuffering :: BufferMode
LineBuffering :: BufferMode
BlockBuffering :: Maybe Int -> BufferMode

-- | Lifted version of hSetBuffering
hSetBuffering :: MonadIO m => Handle -> BufferMode -> m ()

-- | Lifted version of hGetBuffering
hGetBuffering :: MonadIO m => Handle -> m BufferMode

-- | Lifted version of hSeek
hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m ()
data SeekMode
AbsoluteSeek :: SeekMode
RelativeSeek :: SeekMode
SeekFromEnd :: SeekMode

-- | Lifted version of hTell
hTell :: MonadIO m => Handle -> m Integer

-- | Lifted version of hIsOpen
hIsOpen :: MonadIO m => Handle -> m Bool

-- | Lifted version of hIsClosed
hIsClosed :: MonadIO m => Handle -> m Bool

-- | Lifted version of hIsReadable
hIsReadable :: MonadIO m => Handle -> m Bool

-- | Lifted version of hIsWritable
hIsWritable :: MonadIO m => Handle -> m Bool

-- | Lifted version of hIsSeekable
hIsSeekable :: MonadIO m => Handle -> m Bool

-- | Lifted version of hIsTerminalDevice
hIsTerminalDevice :: MonadIO m => Handle -> m Bool

-- | Lifted version of hSetEcho
hSetEcho :: MonadIO m => Handle -> Bool -> m ()

-- | Lifted version of hGetEcho
hGetEcho :: MonadIO m => Handle -> m Bool

-- | Lifted version of hWaitForInput
hWaitForInput :: MonadIO m => Handle -> Int -> m Bool

-- | Lifted version of hReady
hReady :: MonadIO m => Handle -> m Bool

-- | Get the number of seconds which have passed since an arbitrary
--   starting time, useful for calculating runtime in a program.
getMonotonicTime :: MonadIO m => m Double

-- | Unlifted Data.IORef.
module UnliftIO.IORef
data IORef a

-- | Lifted newIORef.
newIORef :: MonadIO m => a -> m (IORef a)

-- | Lifted readIORef.
readIORef :: MonadIO m => IORef a -> m a

-- | Lifted writeIORef.
writeIORef :: MonadIO m => IORef a -> a -> m ()

-- | Lifted modifyIORef.
modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m ()

-- | Lifted modifyIORef'.
modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m ()

-- | Lifted atomicModifyIORef.
atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b

-- | Lifted atomicModifyIORef'.
atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b

-- | Lifted atomicWriteIORef.
atomicWriteIORef :: MonadIO m => IORef a -> a -> m ()

-- | Unlifted mkWeakIORef.
mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef a))

module UnliftIO.Internals.Async

-- | Unlifted async.
async :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted asyncBound.
asyncBound :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted asyncOn.
asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a)

-- | Unlifted asyncWithUnmask.
asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a)

-- | Unlifted asyncOnWithUnmask.
asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a)

-- | Unlifted withAsync.
withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncBound.
withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncOn.
withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncWithUnmask.
withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Unlifted withAsyncOnWithMask.
withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Lifted wait.
wait :: MonadIO m => Async a -> m a

-- | Lifted poll.
poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a))

-- | Lifted waitCatch.
waitCatch :: MonadIO m => Async a -> m (Either SomeException a)

-- | Lifted cancel.
cancel :: MonadIO m => Async a -> m ()

-- | Lifted uninterruptibleCancel.
uninterruptibleCancel :: MonadIO m => Async a -> m ()

-- | Lifted cancelWith. Additionally uses toAsyncException to
--   ensure async exception safety.
cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m ()

-- | Lifted waitAny.
waitAny :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted waitAnyCatch.
waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted waitAnyCancel.
waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted waitAnyCatchCancel.
waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted waitEither.
waitEither :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted waitEitherCatch.
waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted waitEitherCancel.
waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted waitEitherCatchCancel.
waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted waitEither_.
waitEither_ :: MonadIO m => Async a -> Async b -> m ()

-- | Lifted waitBoth.
waitBoth :: MonadIO m => Async a -> Async b -> m (a, b)

-- | Lifted link.
link :: MonadIO m => Async a -> m ()

-- | Lifted link2.
link2 :: MonadIO m => Async a -> Async b -> m ()

-- | Unlifted race.
race :: MonadUnliftIO m => m a -> m b -> m (Either a b)

-- | Unlifted race_.
race_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Unlifted concurrently.
concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)

-- | Unlifted concurrently_.
concurrently_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Unlifted Concurrently.
newtype Concurrently m a
Concurrently :: m a -> Concurrently m a
[runConcurrently] :: Concurrently m a -> m a

-- | Similar to mapConcurrently but with arguments flipped
forConcurrently :: MonadUnliftIO m => Traversable t => t a -> (a -> m b) -> m (t b)

-- | Similar to mapConcurrently_ but with arguments flipped
forConcurrently_ :: MonadUnliftIO m => Foldable f => f a -> (a -> m b) -> m ()

-- | Unlifted replicateConcurrently.
replicateConcurrently :: MonadUnliftIO m => Int -> m b -> m [b]

-- | Unlifted replicateConcurrently_.
replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> m ()

-- | Executes a Traversable container of items concurrently, it uses
--   the Flat type internally.
mapConcurrently :: MonadUnliftIO m => Traversable t => (a -> m b) -> t a -> m (t b)

-- | Executes a Traversable container of items concurrently, it uses
--   the Flat type internally. This function ignores the results.
mapConcurrently_ :: MonadUnliftIO m => Foldable f => (a -> m b) -> f a -> m ()

-- | A more efficient alternative to Concurrently, which reduces the
--   number of threads that need to be forked. For more information, see
--   FIXME link to blog post. This is provided as a separate type
--   to Concurrently as it has a slightly different API.
--   
--   Use the conc function to construct values of type Conc,
--   and runConc to execute the composed actions. You can use the
--   Applicative instance to run different actions and wait for
--   all of them to complete, or the Alternative instance to wait
--   for the first thread to complete.
--   
--   In the event of a runtime exception thrown by any of the children
--   threads, or an asynchronous exception received in the parent thread,
--   all threads will be killed with an AsyncCancelled exception and
--   the original exception rethrown. If multiple exceptions are generated
--   by different threads, there are no guarantees on which exception will
--   end up getting rethrown.
--   
--   For many common use cases, you may prefer using helper functions in
--   this module like mapConcurrently.
--   
--   There are some intentional differences in behavior to
--   Concurrently:
--   
--   
--   
- Children threads are always launched in an unmasked state, not the
--   inherited state of the parent thread.
--   
--   
--   Note that it is a programmer error to use the Alternative
--   instance in such a way that there are no alternatives to an empty,
--   e.g. runConc (empty | empty). In such a case, a
--   ConcException will be thrown. If there was an
--   Alternative in the standard libraries without empty,
--   this library would use it instead.
data Conc m a
[Action] :: m a -> Conc m a
[Apply] :: Conc m (v -> a) -> Conc m v -> Conc m a
[LiftA2] :: (x -> y -> a) -> Conc m x -> Conc m y -> Conc m a
[Pure] :: a -> Conc m a
[Alt] :: Conc m a -> Conc m a -> Conc m a
[Empty] :: Conc m a

-- | Construct a value of type Conc from an action. Compose these
--   values using the typeclass instances (most commonly Applicative
--   and Alternative) and then run with runConc.
conc :: m a -> Conc m a

-- | Run a Conc value on multiple threads.
runConc :: MonadUnliftIO m => Conc m a -> m a

-- | Flattened structure, either Applicative or Alternative
data Flat a
FlatApp :: !FlatApp a -> Flat a

-- | Flattened Alternative. Has at least 2 entries, which must be FlatApp
--   (no nesting of FlatAlts).
FlatAlt :: !FlatApp a -> !FlatApp a -> ![FlatApp a] -> Flat a

-- | Flattened Applicative. No Alternative stuff directly in here, but may
--   be in the children. Notice this type doesn't have a type parameter for
--   monadic contexts, it hardwires the base monad to IO given concurrency
--   relies eventually on that.
data FlatApp a
[FlatPure] :: a -> FlatApp a
[FlatAction] :: IO a -> FlatApp a
[FlatApply] :: Flat (v -> a) -> Flat v -> FlatApp a
[FlatLiftA2] :: (x -> y -> a) -> Flat x -> Flat y -> FlatApp a

-- | Things that can go wrong in the structure of a Conc. These are
--   programmer errors.
data ConcException
EmptyWithNoAlternative :: ConcException

-- | Simple difference list, for nicer types below
type DList a = [a] -> [a]
dlistConcat :: DList a -> DList a -> DList a
dlistCons :: a -> DList a -> DList a
dlistConcatAll :: [DList a] -> DList a
dlistToList :: DList a -> [a]
dlistSingleton :: a -> DList a
dlistEmpty :: DList a

-- | Turn a Conc into a Flat. Note that thanks to the
--   ugliness of empty, this may fail, e.g. flatten Empty.
flatten :: forall m a. MonadUnliftIO m => Conc m a -> m (Flat a)

-- | Run a Flat a on multiple threads.
runFlat :: Flat a -> IO a

-- | Like mapConcurrently from async, but instead of one thread per
--   element, it does pooling from a set of threads. This is useful in
--   scenarios where resource consumption is bounded and for use cases
--   where too many concurrent tasks aren't allowed.
--   
--   
Example usage
--   
--   
--   import Say
--   
--   action :: Int -> IO Int
--   action n = do
--     tid <- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx <- pooledMapConcurrentlyN 5 (\x -> action x) [1..5]
--     print yx
--   
--   
--   On executing you can see that five threads have been spawned:
--   
--   
--   $ ./pool
--   ThreadId 36
--   ThreadId 38
--   ThreadId 40
--   ThreadId 42
--   ThreadId 44
--   [1,2,3,4,5]
--   
--   
--   Let's modify the above program such that there are less threads than
--   the number of items in the list:
--   
--   
--   import Say
--   
--   action :: Int -> IO Int
--   action n = do
--     tid <- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx <- pooledMapConcurrentlyN 3 (\x -> action x) [1..5]
--     print yx
--   
--   
--   On executing you can see that only three threads are active totally:
--   
--   
--   $ ./pool
--   ThreadId 35
--   ThreadId 37
--   ThreadId 39
--   ThreadId 35
--   ThreadId 39
--   [1,2,3,4,5]
--   
pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b)

-- | Similar to pooledMapConcurrentlyN but with number of threads
--   set from getNumCapabilities. Usually this is useful for CPU
--   bound tasks.
pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)

-- | Similar to pooledMapConcurrentlyN but with flipped arguments.
pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b)

-- | Similar to pooledForConcurrentlyN but with number of threads
--   set from getNumCapabilities. Usually this is useful for CPU
--   bound tasks.
pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)
pooledMapConcurrentlyIO :: Traversable t => Int -> (a -> IO b) -> t a -> IO (t b)

-- | Performs the actual pooling for the tasks. This function will continue
--   execution until the task queue becomes empty. When one of the pooled
--   thread finishes it's task, it will pickup the next task from the queue
--   if an job is available.
pooledConcurrently :: Int -> IORef [a] -> (a -> IO ()) -> IO ()
pooledMapConcurrentlyIO' :: Traversable t => Int -> (a -> IO b) -> t a -> IO (t b)
pooledMapConcurrentlyIO_' :: Foldable t => Int -> (a -> IO ()) -> t a -> IO ()
pooledMapConcurrentlyIO_ :: Foldable t => Int -> (a -> IO b) -> t a -> IO ()

-- | Like pooledMapConcurrentlyN but with the return value
--   discarded.
pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m ()

-- | Like pooledMapConcurrently but with the return value discarded.
pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()

-- | Like pooledMapConcurrently_ but with flipped arguments.
pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()

-- | Like pooledMapConcurrentlyN_ but with flipped arguments.
pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m ()

-- | Pooled version of replicateConcurrently. Performs the action in
--   the pooled threads.
pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a]

-- | Similar to pooledReplicateConcurrentlyN but with number of
--   threads set from getNumCapabilities. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a]

-- | Pooled version of replicateConcurrently_. Performs the action
--   in the pooled threads.
pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m ()

-- | Similar to pooledReplicateConcurrently_ but with number of
--   threads set from getNumCapabilities. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m ()
instance GHC.Classes.Ord UnliftIO.Internals.Async.ConcException
instance GHC.Classes.Eq UnliftIO.Internals.Async.ConcException
instance GHC.Show.Show UnliftIO.Internals.Async.ConcException
instance GHC.Generics.Generic UnliftIO.Internals.Async.ConcException
instance GHC.Base.Functor m => GHC.Base.Functor (UnliftIO.Internals.Async.Conc m)
instance GHC.Base.Functor UnliftIO.Internals.Async.Flat
instance GHC.Base.Functor UnliftIO.Internals.Async.FlatApp
instance GHC.Exception.Type.Exception UnliftIO.Internals.Async.ConcException
instance GHC.Base.Applicative UnliftIO.Internals.Async.Flat
instance GHC.Base.Applicative UnliftIO.Internals.Async.FlatApp
instance Control.Monad.IO.Unlift.MonadUnliftIO m => GHC.Base.Applicative (UnliftIO.Internals.Async.Conc m)
instance Control.Monad.IO.Unlift.MonadUnliftIO m => GHC.Base.Alternative (UnliftIO.Internals.Async.Conc m)
instance (Control.Monad.IO.Unlift.MonadUnliftIO m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (UnliftIO.Internals.Async.Conc m a)
instance (GHC.Base.Monoid a, Control.Monad.IO.Unlift.MonadUnliftIO m) => GHC.Base.Monoid (UnliftIO.Internals.Async.Conc m a)
instance GHC.Base.Monad m => GHC.Base.Functor (UnliftIO.Internals.Async.Concurrently m)
instance Control.Monad.IO.Unlift.MonadUnliftIO m => GHC.Base.Applicative (UnliftIO.Internals.Async.Concurrently m)
instance Control.Monad.IO.Unlift.MonadUnliftIO m => GHC.Base.Alternative (UnliftIO.Internals.Async.Concurrently m)
instance (Control.Monad.IO.Unlift.MonadUnliftIO m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (UnliftIO.Internals.Async.Concurrently m a)
instance (GHC.Base.Semigroup a, GHC.Base.Monoid a, Control.Monad.IO.Unlift.MonadUnliftIO m) => GHC.Base.Monoid (UnliftIO.Internals.Async.Concurrently m a)

-- | Unlifted Control.Concurrent.Async.
module UnliftIO.Async

-- | An asynchronous action spawned by async or withAsync.
--   Asynchronous actions are executed in a separate thread, and operations
--   are provided for waiting for asynchronous actions to complete and
--   obtaining their results (see e.g. wait).
data Async a

-- | Unlifted async.
async :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted asyncBound.
asyncBound :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted asyncOn.
asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a)

-- | Unlifted asyncWithUnmask.
asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a)

-- | Unlifted asyncOnWithUnmask.
asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a)

-- | Unlifted withAsync.
withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncBound.
withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncOn.
withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b

-- | Unlifted withAsyncWithUnmask.
withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Unlifted withAsyncOnWithMask.
withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Lifted wait.
wait :: MonadIO m => Async a -> m a

-- | Lifted poll.
poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a))

-- | Lifted waitCatch.
waitCatch :: MonadIO m => Async a -> m (Either SomeException a)

-- | Lifted cancel.
cancel :: MonadIO m => Async a -> m ()

-- | Lifted uninterruptibleCancel.
uninterruptibleCancel :: MonadIO m => Async a -> m ()

-- | Lifted cancelWith. Additionally uses toAsyncException to
--   ensure async exception safety.
cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m ()

-- | Returns the ThreadId of the thread running the given
--   Async.
asyncThreadId :: Async a -> ThreadId

-- | A version of wait that can be used inside an STM transaction.
waitSTM :: Async a -> STM a

-- | A version of poll that can be used inside an STM transaction.
pollSTM :: Async a -> STM (Maybe (Either SomeException a))

-- | A version of waitCatch that can be used inside an STM
--   transaction.
waitCatchSTM :: Async a -> STM (Either SomeException a)

-- | Lifted waitAny.
waitAny :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted waitAnyCatch.
waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted waitAnyCancel.
waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted waitAnyCatchCancel.
waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted waitEither.
waitEither :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted waitEitherCatch.
waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted waitEitherCancel.
waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted waitEitherCatchCancel.
waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted waitEither_.
waitEither_ :: MonadIO m => Async a -> Async b -> m ()

-- | Lifted waitBoth.
waitBoth :: MonadIO m => Async a -> Async b -> m (a, b)

-- | A version of waitAny that can be used inside an STM
--   transaction.
waitAnySTM :: [Async a] -> STM (Async a, a)

-- | A version of waitAnyCatch that can be used inside an STM
--   transaction.
waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)

-- | A version of waitEither that can be used inside an STM
--   transaction.
waitEitherSTM :: Async a -> Async b -> STM (Either a b)

-- | A version of waitEitherCatch that can be used inside an STM
--   transaction.
waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))

-- | A version of waitEither_ that can be used inside an STM
--   transaction.
waitEitherSTM_ :: Async a -> Async b -> STM ()

-- | A version of waitBoth that can be used inside an STM
--   transaction.
waitBothSTM :: Async a -> Async b -> STM (a, b)

-- | Lifted link.
link :: MonadIO m => Async a -> m ()

-- | Lifted link2.
link2 :: MonadIO m => Async a -> Async b -> m ()

-- | Like mapConcurrently from async, but instead of one thread per
--   element, it does pooling from a set of threads. This is useful in
--   scenarios where resource consumption is bounded and for use cases
--   where too many concurrent tasks aren't allowed.
--   
--   
Example usage
--   
--   
--   import Say
--   
--   action :: Int -> IO Int
--   action n = do
--     tid <- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx <- pooledMapConcurrentlyN 5 (\x -> action x) [1..5]
--     print yx
--   
--   
--   On executing you can see that five threads have been spawned:
--   
--   
--   $ ./pool
--   ThreadId 36
--   ThreadId 38
--   ThreadId 40
--   ThreadId 42
--   ThreadId 44
--   [1,2,3,4,5]
--   
--   
--   Let's modify the above program such that there are less threads than
--   the number of items in the list:
--   
--   
--   import Say
--   
--   action :: Int -> IO Int
--   action n = do
--     tid <- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx <- pooledMapConcurrentlyN 3 (\x -> action x) [1..5]
--     print yx
--   
--   
--   On executing you can see that only three threads are active totally:
--   
--   
--   $ ./pool
--   ThreadId 35
--   ThreadId 37
--   ThreadId 39
--   ThreadId 35
--   ThreadId 39
--   [1,2,3,4,5]
--   
pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b)

-- | Similar to pooledMapConcurrentlyN but with number of threads
--   set from getNumCapabilities. Usually this is useful for CPU
--   bound tasks.
pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)

-- | Like pooledMapConcurrentlyN but with the return value
--   discarded.
pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m ()

-- | Like pooledMapConcurrently but with the return value discarded.
pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()

-- | Similar to pooledMapConcurrentlyN but with flipped arguments.
pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b)

-- | Similar to pooledForConcurrentlyN but with number of threads
--   set from getNumCapabilities. Usually this is useful for CPU
--   bound tasks.
pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)

-- | Like pooledMapConcurrentlyN_ but with flipped arguments.
pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m ()

-- | Like pooledMapConcurrently_ but with flipped arguments.
pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()

-- | Pooled version of replicateConcurrently. Performs the action in
--   the pooled threads.
pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a]

-- | Similar to pooledReplicateConcurrentlyN but with number of
--   threads set from getNumCapabilities. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a]

-- | Pooled version of replicateConcurrently_. Performs the action
--   in the pooled threads.
pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m ()

-- | Similar to pooledReplicateConcurrently_ but with number of
--   threads set from getNumCapabilities. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m ()

-- | Unlifted race.
race :: MonadUnliftIO m => m a -> m b -> m (Either a b)

-- | Unlifted race_.
race_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Unlifted concurrently.
concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)

-- | Unlifted concurrently_.
concurrently_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Executes a Traversable container of items concurrently, it uses
--   the Flat type internally.
mapConcurrently :: MonadUnliftIO m => Traversable t => (a -> m b) -> t a -> m (t b)

-- | Similar to mapConcurrently but with arguments flipped
forConcurrently :: MonadUnliftIO m => Traversable t => t a -> (a -> m b) -> m (t b)

-- | Executes a Traversable container of items concurrently, it uses
--   the Flat type internally. This function ignores the results.
mapConcurrently_ :: MonadUnliftIO m => Foldable f => (a -> m b) -> f a -> m ()

-- | Similar to mapConcurrently_ but with arguments flipped
forConcurrently_ :: MonadUnliftIO m => Foldable f => f a -> (a -> m b) -> m ()

-- | Unlifted replicateConcurrently.
replicateConcurrently :: MonadUnliftIO m => Int -> m b -> m [b]

-- | Unlifted replicateConcurrently_.
replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> m ()

-- | Unlifted Concurrently.
newtype Concurrently m a
Concurrently :: m a -> Concurrently m a
[runConcurrently] :: Concurrently m a -> m a

-- | A more efficient alternative to Concurrently, which reduces the
--   number of threads that need to be forked. For more information, see
--   FIXME link to blog post. This is provided as a separate type
--   to Concurrently as it has a slightly different API.
--   
--   Use the conc function to construct values of type Conc,
--   and runConc to execute the composed actions. You can use the
--   Applicative instance to run different actions and wait for
--   all of them to complete, or the Alternative instance to wait
--   for the first thread to complete.
--   
--   In the event of a runtime exception thrown by any of the children
--   threads, or an asynchronous exception received in the parent thread,
--   all threads will be killed with an AsyncCancelled exception and
--   the original exception rethrown. If multiple exceptions are generated
--   by different threads, there are no guarantees on which exception will
--   end up getting rethrown.
--   
--   For many common use cases, you may prefer using helper functions in
--   this module like mapConcurrently.
--   
--   There are some intentional differences in behavior to
--   Concurrently:
--   
--   
--   
- Children threads are always launched in an unmasked state, not the
--   inherited state of the parent thread.
--   
--   
--   Note that it is a programmer error to use the Alternative
--   instance in such a way that there are no alternatives to an empty,
--   e.g. runConc (empty | empty). In such a case, a
--   ConcException will be thrown. If there was an
--   Alternative in the standard libraries without empty,
--   this library would use it instead.
data Conc m a

-- | Construct a value of type Conc from an action. Compose these
--   values using the typeclass instances (most commonly Applicative
--   and Alternative) and then run with runConc.
conc :: m a -> Conc m a

-- | Run a Conc value on multiple threads.
runConc :: MonadUnliftIO m => Conc m a -> m a

-- | Things that can go wrong in the structure of a Conc. These are
--   programmer errors.
data ConcException
EmptyWithNoAlternative :: ConcException

-- | Unlifted Control.Concurrent.MVar.
module UnliftIO.MVar
data MVar a

-- | Lifted newEmptyMVar.
newEmptyMVar :: MonadIO m => m (MVar a)

-- | Lifted newMVar.
newMVar :: MonadIO m => a -> m (MVar a)

-- | Lifted takeMVar.
takeMVar :: MonadIO m => MVar a -> m a

-- | Lifted putMVar.
putMVar :: MonadIO m => MVar a -> a -> m ()

-- | Lifted readMVar.
readMVar :: MonadIO m => MVar a -> m a

-- | Lifted swapMVar.
swapMVar :: MonadIO m => MVar a -> a -> m a

-- | Lifted tryTakeMVar.
tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a)

-- | Lifted tryPutMVar.
tryPutMVar :: MonadIO m => MVar a -> a -> m Bool

-- | Lifted isEmptyMVar.
isEmptyMVar :: MonadIO m => MVar a -> m Bool

-- | Unlifted withMVar.
withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b

-- | Unlifted withMVarMasked.
withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b

-- | Unlifted modifyMVar.
modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b

-- | Unlifted modifyMVar_.
modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()

-- | Unlifted modifyMVarMasked.
modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b

-- | Unlifted modifyMVarMasked_.
modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()

-- | Lifted tryReadMVar.
tryReadMVar :: MonadIO m => MVar a -> m (Maybe a)

-- | Unlifted mkWeakMVar.
mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a))

-- | 
Rationale
--   
--   This module offers functions to handle files that offer better
--   durability and/or atomicity.
--   
--   
When to use functions in this module?
--   
--   Given the usage of this functions comes at a cost in performance, it
--   is important to consider what are the use cases that are ideal for
--   each of the functions.
--   
--   
Not Durable and not Atomic
--   
--   For this use case, you want to use the regular functions:
--   
--   
--   
- withBinaryFile
--   
- writeBinaryFile
--   
--   
--   The regular use case for this scenario happens when your program is
--   dealing with outputs that are never going to be consumed again by your
--   program. For example, imagine you have a program that generates sales
--   reports for the last month, this is a report that can be generated
--   quickly; you don't really care if the output file gets corrupted or
--   lost at one particular execution of your program given that is cheap
--   to execute the data export program a second time. In other words, your
--   program doesn't rely on the data contained in this file in
--   order to work.
--   
--   
Atomic but not Durable
--   
--   Imagine a scenario where your program builds a temporary file that
--   serves as an intermediate step to a bigger task, like Object files
--   (.o) in a compilation process. The program will use an
--   existing .o file if it is present, or it will build one from
--   scratch if it is not. The file is not really required, but if it is
--   present, it *must* be valid and consistent. In this situation, you
--   care about atomicity, but not durability. You can use the functions
--   for such scenario:
--   
--   
--   
- withBinaryFileAtomic
--   
- writeBinaryFileAtomic
--   
--   
--   Note - there is a peculiar difference between regular file
--   writing functionality and the one that is done atomically. Even if the
--   orignal file is removed while it is being modified, because of
--   atomicity, it will be restored with all modifications, if any. The
--   reason for this is because a copy of the file was made prior to
--   modifications and at the end the existing is atomically replaced. An
--   important consequence of this fact is that whenever the folder
--   containing the file which is being modified is removed, all bets are
--   off and all atomic functions will result in an exception.
--   
--   
Durable but not Atomic
--   
--   For this use case, you want to use the functions:
--   
--   
--   
- withBinaryFileDurable
--   
- writeBinaryFileDurable
--   
--   
--   The regular use case for this scenario happens when your program deals
--   with file modifications that must be guaranteed to be durable, but you
--   don't care that changes are consistent. If you use this function, more
--   than likely your program is ensuring consistency guarantees through
--   other means, for example, SQLite uses the Write Ahead Log (WAL)
--   algorithm to ensure changes are atomic at an application level.
--   
--   
Durable and Atomic
--   
--   For this use case, you can use the functions:
--   
--   
--   
- withBinaryFileDurableAtomic
--   
- writeBinaryFileDurableAtomic
--   
--   
--   The regular use case for this scenario happens when you want to ensure
--   that after a program is executed, the modifications done to a file are
--   guaranteed to be saved, and also that changes are rolled-back in case
--   there is a failure (e.g. hard reboot, shutdown, etc).
module UnliftIO.IO.File

-- | Lifted version of writeFile
writeBinaryFile :: MonadIO m => FilePath -> ByteString -> m ()

-- | Same as writeBinaryFileDurableAtomic, except it does not
--   guarantee durability.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileAtomic :: MonadIO m => FilePath -> ByteString -> m ()

-- | Similar to writeBinaryFile, but it also ensures that changes
--   executed to the file are guaranteed to be durable. It internally uses
--   fsync() and makes sure it synchronizes the file on disk.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileDurable :: MonadIO m => FilePath -> ByteString -> m ()

-- | Similar to writeBinaryFile, but it also guarantes that changes
--   executed to the file are durable, also, in case of failure, the
--   modified file is never going to get corrupted. It internally uses
--   fsync() and makes sure it synchronizes the file on disk.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileDurableAtomic :: MonadIO m => FilePath -> ByteString -> m ()

-- | Unlifted version of withBinaryFile.
withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Perform an action on a new or existing file at the destination file
--   path. If previously the file existed at the supplied file path then:
--   
--   
--   
- in case of WriteMode it will be overwritten
--   
- upon ReadWriteMode or AppendMode files contents will
--   be copied over into a temporary file, thus making sure no corruption
--   can happen to an existing file upon any failures, even catastrophic
--   one, yet its contents are availble for modification.
--   
- There is nothing atomic about ReadMode, so no special
--   treatment there.
--   
--   
--   It is similar to withBinaryFileDurableAtomic, but without the
--   durability part. It means that all modification can still disappear
--   after it has been succesfully written due to some extreme event like
--   an abrupt power loss, but the contents will not be corrupted in case
--   when the file write did not end successfully.
--   
--   The same performance caveats apply as for
--   withBinaryFileDurableAtomic due to making a copy of the content
--   of existing files during non-truncating writes.
--   
--   Important - Do not close the handle, otherwise it will result
--   in invalid argument (Bad file descriptor) exception
--   
--   Note - on Linux operating system and only with supported file
--   systems an anonymous temporary file will be used while working on the
--   file (see O_TMPFILE in man openat). In case when
--   such feature is not available or not supported a temporary file
--   ".target-file-nameXXX.ext.tmp", where XXX is some random number, will
--   be created alongside the target file in the same directory
withBinaryFileAtomic :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | Opens a file with the following guarantees:
--   
--   
--   
- It successfully closes the file in case of an asynchronous
--   exception
--   
- It reliably saves the file in the correct directory; including
--   edge case situations like a different device being mounted to the
--   current directory, or the current directory being renamed to some
--   other name while the file is being used.
--   
- It ensures durability by executing an fsync() call before
--   closing the file handle
--   
--   
--   
Cross-Platform support
--   
--   This function behaves the same as withBinaryFile on Windows
--   platforms.
withBinaryFileDurable :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | Opens a file with the following guarantees:
--   
--   
--   
- It successfully closes the file in case of an asynchronous
--   exception
--   
- It reliably saves the file in the correct directory; including
--   edge case situations like a different device being mounted to the
--   current directory, or the current directory being renamed to some
--   other name while the file is being used.
--   
- It ensures durability by executing an fsync() call before
--   closing the file handle
--   
- It keeps all changes in a temporary file, and after it is closed
--   it atomically moves the temporary file to the original filepath, in
--   case of catastrophic failure, the original file stays unaffected.
--   
--   
--   If you do not need durability but only atomicity, use
--   withBinaryFileAtomic instead, which is faster as it does not
--   perform fsync().
--   
--   Important - Make sure not to close the Handle, it will
--   be closed for you, otherwise it will result in invalid argument
--   (Bad file descriptor) exception.
--   
--   
Performance Considerations
--   
--   When using a writable but non-truncating IOMode (i.e.
--   ReadWriteMode and AppendMode), this function performs a
--   copy operation of the specified input file to guarantee the original
--   file is intact in case of a catastrophic failure (no partial writes).
--   This approach may be prohibitive in scenarios where the input file is
--   expected to be large in size.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as withBinaryFile on Windows
--   platforms.
withBinaryFileDurableAtomic :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | After a file is closed, this function opens it again and executes
--   fsync() internally on both the file and the directory that
--   contains it. Note that this function is intended to work around the
--   non-durability of existing file APIs, as opposed to being necessary
--   for the API functions provided in this module.
--   
--   The effectiveness of calling this function is debatable, as it
--   relies on internal implementation details at the Kernel level that
--   might change. We argue that, despite this fact, calling this function
--   may bring benefits in terms of durability.
--   
--   This function does not provide the same guarantee as if you would open
--   and modify a file using withBinaryFileDurable or
--   writeBinaryFileDurable, since they ensure that the
--   fsync() is called before the file is closed, so if possible
--   use those instead.
--   
--   
Cross-Platform support
--   
--   This function is a noop on Windows platforms.
ensureFileDurable :: MonadIO m => FilePath -> m ()

-- | Unlifted Control.Concurrent.
--   
--   This module is not reexported by UnliftIO, use it only if
--   UnliftIO.Async is not enough.
module UnliftIO.Concurrent
data ThreadId

-- | Lifted version of myThreadId.
myThreadId :: MonadIO m => m ThreadId

-- | Unlifted version of forkIO.
forkIO :: MonadUnliftIO m => m () -> m ThreadId

-- | Please use forkIOWithUnmask instead. This function has been
--   deprecated in release 0.2.11 and will be removed in the next major
--   release.

-- | Deprecated: forkWithUnmask has been renamed to forkIOWithUnmask
forkWithUnmask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m ()) -> m ThreadId

-- | Unlifted version of forkIOWithUnmask.
forkIOWithUnmask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m ()) -> m ThreadId

-- | Unlifted version of forkFinally.
forkFinally :: MonadUnliftIO m => m a -> (Either SomeException a -> m ()) -> m ThreadId

-- | Lifted version of killThread.
killThread :: MonadIO m => ThreadId -> m ()

-- | Throw an asynchronous exception to another thread.
--   
--   Synchronously typed exceptions will be wrapped into an
--   AsyncExceptionWrapper, see
--   https://github.com/fpco/safe-exceptions#determining-sync-vs-async.
--   
--   It's usually a better idea to use the UnliftIO.Async module,
--   see https://github.com/fpco/safe-exceptions#quickstart.
throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m ()

-- | Unlifted version of forkOn.
forkOn :: MonadUnliftIO m => Int -> m () -> m ThreadId

-- | Unlifted version of forkOnWithUnmask.
forkOnWithUnmask :: MonadUnliftIO m => Int -> ((forall a. m a -> m a) -> m ()) -> m ThreadId

-- | Lifted version of getNumCapabilities.
getNumCapabilities :: MonadIO m => m Int

-- | Lifted version of setNumCapabilities.
setNumCapabilities :: MonadIO m => Int -> m ()

-- | Lifted version of threadCapability.
threadCapability :: MonadIO m => ThreadId -> m (Int, Bool)

-- | Lifted version of yield.
yield :: MonadIO m => m ()

-- | Lifted version of threadDelay.
threadDelay :: MonadIO m => Int -> m ()

-- | Lifted version of threadWaitRead.
threadWaitRead :: MonadIO m => Fd -> m ()

-- | Lifted version of threadWaitWrite.
threadWaitWrite :: MonadIO m => Fd -> m ()
rtsSupportsBoundThreads :: Bool

-- | Unflifted version of forkOS.
forkOS :: MonadUnliftIO m => m () -> m ThreadId

-- | Lifted version of isCurrentThreadBound.
isCurrentThreadBound :: MonadIO m => m Bool

-- | Unlifted version of runInBoundThread.
runInBoundThread :: MonadUnliftIO m => m a -> m a

-- | Unlifted version of runInUnboundThread.
runInUnboundThread :: MonadUnliftIO m => m a -> m a

-- | Lifted version of mkWeakThreadId.
mkWeakThreadId :: MonadIO m => ThreadId -> m (Weak ThreadId)

-- | Memoize the results of actions. In other words: actions will be run
--   once, on demand, and their results saved.
--   
--   Exceptions semantics: if a synchronous exception is thrown while
--   performing the computation, that result will be saved and rethrown
--   each time runMemoized is called subsequently.'
module UnliftIO.Memoize

-- | A "run once" value, with results saved. Extract the value with
--   runMemoized. For single-threaded usage, you can use
--   memoizeRef to create a value. If you need guarantees that only
--   one thread will run the action at a time, use memoizeMVar.
--   
--   Note that this type provides a Show instance for convenience,
--   but not useful information can be provided.
data Memoized a

-- | Extract a value from a Memoized, running an action if no cached
--   value is available.
runMemoized :: MonadIO m => Memoized a -> m a

-- | Create a new Memoized value using an IORef under the
--   surface. Note that the action may be run in multiple threads
--   simultaneously, so this may not be thread safe (depending on the
--   underlying action). Consider using memoizeMVar.
memoizeRef :: MonadUnliftIO m => m a -> m (Memoized a)

-- | Same as memoizeRef, but uses an MVar to ensure that an
--   action is only run once, even in a multithreaded application.
memoizeMVar :: MonadUnliftIO m => m a -> m (Memoized a)
instance GHC.Base.Monad UnliftIO.Memoize.Memoized
instance GHC.Base.Applicative UnliftIO.Memoize.Memoized
instance GHC.Base.Functor UnliftIO.Memoize.Memoized
instance GHC.Show.Show (UnliftIO.Memoize.Memoized a)

-- | Unlifted System.Process.
module UnliftIO.Process
data CreateProcess
CreateProcess :: CmdSpec -> Maybe FilePath -> Maybe [(String, String)] -> StdStream -> StdStream -> StdStream -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe GroupID -> Maybe UserID -> Bool -> CreateProcess
[cmdspec] :: CreateProcess -> CmdSpec
[cwd] :: CreateProcess -> Maybe FilePath
[env] :: CreateProcess -> Maybe [(String, String)]
[std_in] :: CreateProcess -> StdStream
[std_out] :: CreateProcess -> StdStream
[std_err] :: CreateProcess -> StdStream
[close_fds] :: CreateProcess -> Bool
[create_group] :: CreateProcess -> Bool
[delegate_ctlc] :: CreateProcess -> Bool
[detach_console] :: CreateProcess -> Bool
[create_new_console] :: CreateProcess -> Bool
[new_session] :: CreateProcess -> Bool
[child_group] :: CreateProcess -> Maybe GroupID
[child_user] :: CreateProcess -> Maybe UserID
[use_process_jobs] :: CreateProcess -> Bool
data CmdSpec
ShellCommand :: String -> CmdSpec
RawCommand :: FilePath -> [String] -> CmdSpec
data StdStream
Inherit :: StdStream
UseHandle :: Handle -> StdStream
CreatePipe :: StdStream
NoStream :: StdStream
data ProcessHandle

-- | Lifted createProcess.
createProcess :: MonadIO m => CreateProcess -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)

-- | Lifted createProcess_.
createProcess_ :: MonadIO m => String -> CreateProcess -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
shell :: String -> CreateProcess
proc :: FilePath -> [String] -> CreateProcess

-- | Lifted callProcess.
callProcess :: MonadIO m => FilePath -> [String] -> m ()

-- | Lifted callCommand.
callCommand :: MonadIO m => String -> m ()

-- | Lifted spawnProcess.
spawnProcess :: MonadIO m => FilePath -> [String] -> m ProcessHandle

-- | Lifted spawnCommand.
spawnCommand :: MonadIO m => String -> m ProcessHandle

-- | Lifted readCreateProcess.
readCreateProcess :: MonadIO m => CreateProcess -> String -> m String

-- | Lifted readProcess.
readProcess :: MonadIO m => FilePath -> [String] -> String -> m String

-- | Lifted readCreateProcessWithExitCode.
readCreateProcessWithExitCode :: MonadIO m => CreateProcess -> String -> m (ExitCode, String, String)

-- | Lifted readProcessWithExitCode.
readProcessWithExitCode :: MonadIO m => FilePath -> [String] -> String -> m (ExitCode, String, String)

-- | Unlifted withCreateProcess.
withCreateProcess :: MonadUnliftIO m => CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> m a) -> m a
showCommandForUser :: FilePath -> [String] -> String

-- | Lifted waitForProcess.
waitForProcess :: MonadIO m => ProcessHandle -> m ExitCode

-- | Lifted getProcessExitCode.
getProcessExitCode :: MonadIO m => ProcessHandle -> m (Maybe ExitCode)

-- | Lifted terminateProcess.
terminateProcess :: MonadIO m => ProcessHandle -> m ()

-- | Lifted interruptProcessGroupOf.
interruptProcessGroupOf :: MonadIO m => ProcessHandle -> m ()

-- | Lifted createPipe.
createPipe :: MonadIO m => m (Handle, Handle)

-- | Lifted createPipeFd.
createPipeFd :: MonadIO m => m (FD, FD)

-- | Lifted version of Control.Concurrent.STM
module UnliftIO.STM
data STM a

-- | Lifted version of atomically
atomically :: MonadIO m => STM a -> m a

-- | Renamed retry for unqualified export
retrySTM :: STM a

-- | Renamed check for unqualified export
checkSTM :: Bool -> STM ()
orElse :: STM a -> STM a -> STM a
data TVar a

-- | Lifted version of newTVarIO
newTVarIO :: MonadIO m => a -> m (TVar a)

-- | Lifted version of readTVarIO
readTVarIO :: MonadIO m => TVar a -> m a
newTVar :: a -> STM (TVar a)
readTVar :: TVar a -> STM a
writeTVar :: TVar a -> a -> STM ()
modifyTVar :: TVar a -> (a -> a) -> STM ()
modifyTVar' :: TVar a -> (a -> a) -> STM ()
swapTVar :: TVar a -> a -> STM a

-- | Lifted version of registerDelay
registerDelay :: MonadIO m => Int -> m (TVar Bool)

-- | Lifted version of mkWeakTVar
mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a))
data TMVar a
newTMVar :: a -> STM (TMVar a)
newEmptyTMVar :: STM (TMVar a)

-- | Lifted version of newTMVarIO
newTMVarIO :: MonadIO m => a -> m (TMVar a)

-- | Lifted version of newEmptyTMVarIO
newEmptyTMVarIO :: MonadIO m => m (TMVar a)
takeTMVar :: TMVar a -> STM a
putTMVar :: TMVar a -> a -> STM ()
readTMVar :: TMVar a -> STM a
tryReadTMVar :: TMVar a -> STM (Maybe a)
swapTMVar :: TMVar a -> a -> STM a
tryTakeTMVar :: TMVar a -> STM (Maybe a)
tryPutTMVar :: TMVar a -> a -> STM Bool
isEmptyTMVar :: TMVar a -> STM Bool

-- | Lifted version of mkWeakTMVar
mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a))
data TChan a
newTChan :: STM (TChan a)

-- | Lifted version of newTChanIO
newTChanIO :: MonadIO m => m (TChan a)
newBroadcastTChan :: STM (TChan a)

-- | Lifted version of newBroadcastTChanIO
newBroadcastTChanIO :: MonadIO m => m (TChan a)
dupTChan :: TChan a -> STM (TChan a)
cloneTChan :: TChan a -> STM (TChan a)
readTChan :: TChan a -> STM a
tryReadTChan :: TChan a -> STM (Maybe a)
peekTChan :: TChan a -> STM a
tryPeekTChan :: TChan a -> STM (Maybe a)
writeTChan :: TChan a -> a -> STM ()
unGetTChan :: TChan a -> a -> STM ()
isEmptyTChan :: TChan a -> STM Bool
data TQueue a
newTQueue :: STM (TQueue a)

-- | Lifted version of newTQueueIO
newTQueueIO :: MonadIO m => m (TQueue a)
readTQueue :: TQueue a -> STM a
tryReadTQueue :: TQueue a -> STM (Maybe a)
peekTQueue :: TQueue a -> STM a
tryPeekTQueue :: TQueue a -> STM (Maybe a)
writeTQueue :: TQueue a -> a -> STM ()
unGetTQueue :: TQueue a -> a -> STM ()
isEmptyTQueue :: TQueue a -> STM Bool
data TBQueue a
newTBQueue :: Natural -> STM (TBQueue a)

-- | Lifted version of newTBQueueIO
newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a)
readTBQueue :: TBQueue a -> STM a
tryReadTBQueue :: TBQueue a -> STM (Maybe a)
peekTBQueue :: TBQueue a -> STM a
tryPeekTBQueue :: TBQueue a -> STM (Maybe a)
writeTBQueue :: TBQueue a -> a -> STM ()
unGetTBQueue :: TBQueue a -> a -> STM ()
isEmptyTBQueue :: TBQueue a -> STM Bool
isFullTBQueue :: TBQueue a -> STM Bool

-- | Temporary file and directory support.
--   
--   Strongly inspired by/stolen from the
--   https://github.com/feuerbach/temporary package.
module UnliftIO.Temporary

-- | Create and use a temporary file in the system standard temporary
--   directory.
--   
--   Behaves exactly the same as withTempFile, except that the
--   parent temporary directory will be that returned by
--   getCanonicalTemporaryDirectory.
withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a

-- | Create and use a temporary directory in the system standard temporary
--   directory.
--   
--   Behaves exactly the same as withTempDirectory, except that the
--   parent temporary directory will be that returned by
--   getCanonicalTemporaryDirectory.
withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a

-- | Use a temporary filename that doesn't already exist.
--   
--   Creates a new temporary file inside the given directory, making use of
--   the template. The temp file is deleted after use. For example:
--   
--   
--   withTempFile "src" "sdist." $ \tmpFile hFile -> do ...
--   
--   
--   The tmpFile will be file in the given directory, e.g.
--   src/sdist.342.
withTempFile :: MonadUnliftIO m => FilePath -> String -> (FilePath -> Handle -> m a) -> m a

-- | Create and use a temporary directory.
--   
--   Creates a new temporary directory inside the given directory, making
--   use of the template. The temp directory is deleted after use. For
--   example:
--   
--   
--   withTempDirectory "src" "sdist." $ \tmpDir -> do ...
--   
--   
--   The tmpDir will be a new subdirectory of the given directory,
--   e.g. src/sdist.342.
withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a

-- | Unlifted System.Timeout.
module UnliftIO.Timeout

-- | Unlifted timeout.
timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a)

-- | Please see the README.md file for information on using this package at
--   https://www.stackage.org/package/unliftio.
module UnliftIO
