-- | The 'Internal.Scoped' monad to safely allocate and deallocate resources.
module Control.Monad.Scoped
  ( -- * 'Internal.Scoped' computations and 'Internal.ScopedResource's
    Internal.Scoped
  , Internal.ScopedResource

    -- * Safely work with scopes
  , Internal.scoped
  , Internal.registerHandler

    -- * Safely work with 'Control.Concurrent.Async.Async's
  , ScopedAsync.ScopedAsync
  , ScopedAsync.async
  , ScopedAsync.asyncBound
  , ScopedAsync.wait
  , ScopedAsync.waitCatch
  , ScopedAsync.waitScoped
  , ScopedAsync.waitCatchScoped

    -- * Safely work with 'System.IO.Handle's
  , ScopedHandle.ScopedHandle
  , ScopedHandle.file
  , IO.IOMode (..)
  , ScopedHandle.hPutStrLn
  , ScopedHandle.hPutStr
  , ScopedHandle.hGetLine
  , ScopedHandle.hGetContents

    -- * Safely work with tempfiles
  , ScopedTemp.tempFile
  , ScopedTemp.systemTempFile
  )
where

import Control.Monad.Scoped.Async qualified as ScopedAsync
import Control.Monad.Scoped.Handle qualified as ScopedHandle
import Control.Monad.Scoped.Internal qualified as Internal
import Control.Monad.Scoped.Temp qualified as ScopedTemp
import System.IO qualified as IO