packages feed

dear-imgui-raw-1.0.0: src/DearImGui/Context.hs

-- | Exception-safe scope around 'ImGui.createContext' / 'ImGui.destroyContext'.
module DearImGui.Context
  ( withContext
  ) where

import Control.Monad.IO.Unlift (MonadUnliftIO)
import Foreign.Ptr (nullPtr)

import DearImGui.Bracket (withCreated)
import DearImGui.Raw.ImGui qualified as ImGui

withContext :: (MonadUnliftIO m) => m a -> m a
withContext = withCreated (ImGui.createContext nullPtr) ImGui.destroyContext