{- FOURMOLU_DISABLE -}
{-# LANGUAGE CPP #-}

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

    -- * Safely work with scopes
  , Internal.scoped
  , Internal.registerHandler
  , (Internal.:<)

    -- * Safely work with 'Foreign.Ptr's
  , ScopedPtr.Ptr
  , ScopedPtr.foreignPtr
  , ScopedPtr.wrapScoped
  , ScopedPtr.newPtr
  , ScopedPtr.setPtr
  , ScopedPtr.getPtr

#ifndef CORE
    -- * 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
#endif
  )
where

import Control.Monad.Scoped.Internal qualified as Internal
import Control.Monad.Scoped.Ptr qualified as ScopedPtr
#ifndef CORE
import Control.Monad.Scoped.Async qualified as ScopedAsync
import Control.Monad.Scoped.Handle qualified as ScopedHandle
import Control.Monad.Scoped.Temp qualified as ScopedTemp
import System.IO qualified as IO
#endif