{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}

module Gpu.Vulkan.AllocationCallbacks.Internal (

	-- * CREATE

	create, Functions, M.FunctionsInfo(..),

	-- ** Function Types

	M.FnAllocationFunction, M.FnReallocationFunction, M.FnFreeFunction,
	M.FnInternalAllocationNotification, M.FnInternalFreeNotification,

	-- *** Size and Alignment

	M.Size, M.Alignment,

	-- * APPLY

	apply, A, ToMiddle(..)

	) where

import Control.Exception
import Gpu.Vulkan.AllocationCallbacks.Type
import Gpu.Vulkan.AllocationCallbacks.Middle qualified as M

create :: M.FunctionsInfo a -> (forall s . Functions s a -> IO b) -> IO b
create :: forall a b.
FunctionsInfo a -> (forall s. Functions s a -> IO b) -> IO b
create FunctionsInfo a
fns forall s. Functions s a -> IO b
f = IO (Functions a)
-> (Functions a -> IO ()) -> (Functions a -> IO b) -> IO b
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (FunctionsInfo a -> IO (Functions a)
forall a. FunctionsInfo a -> IO (Functions a)
M.create FunctionsInfo a
fns) Functions a -> IO ()
forall a. Functions a -> IO ()
M.destroy (Functions Any a -> IO b
forall s. Functions s a -> IO b
f (Functions Any a -> IO b)
-> (Functions a -> Functions Any a) -> Functions a -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Functions a -> Functions Any a
forall s a. Functions a -> Functions s a
Functions)