{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}

module Data.CairoContext where

import Foreign.Ptr
import Foreign.ForeignPtr
import Control.Monad.Primitive

newtype CairoT r s = CairoT (ForeignPtr (CairoT r s)) deriving Int -> CairoT r s -> ShowS
[CairoT r s] -> ShowS
CairoT r s -> String
(Int -> CairoT r s -> ShowS)
-> (CairoT r s -> String)
-> ([CairoT r s] -> ShowS)
-> Show (CairoT r s)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall r s. Int -> CairoT r s -> ShowS
forall r s. [CairoT r s] -> ShowS
forall r s. CairoT r s -> String
$cshowsPrec :: forall r s. Int -> CairoT r s -> ShowS
showsPrec :: Int -> CairoT r s -> ShowS
$cshow :: forall r s. CairoT r s -> String
show :: CairoT r s -> String
$cshowList :: forall r s. [CairoT r s] -> ShowS
showList :: [CairoT r s] -> ShowS
Show

type CairoTIO r = CairoT r RealWorld

withCairoT :: PrimMonad m => CairoT r (PrimState m) -> (Ptr (CairoT r (PrimState m)) -> IO a) -> m a
withCairoT :: forall (m :: * -> *) r a.
PrimMonad m =>
CairoT r (PrimState m)
-> (Ptr (CairoT r (PrimState m)) -> IO a) -> m a
withCairoT (CairoT ForeignPtr (CairoT r (PrimState m))
fcr) = IO a -> m a
forall (m :: * -> *) a. PrimMonad m => IO a -> m a
unsafeIOToPrim (IO a -> m a)
-> ((Ptr (CairoT r (PrimState m)) -> IO a) -> IO a)
-> (Ptr (CairoT r (PrimState m)) -> IO a)
-> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignPtr (CairoT r (PrimState m))
-> (Ptr (CairoT r (PrimState m)) -> IO a) -> IO a
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr (CairoT r (PrimState m))
fcr