{-# LANGUAGE DeriveDataTypeable, EmptyDataDecls, ForeignFunctionInterface #-}
module Data.Text.ICU.Number.Internal
(
MNumberFormat(..)
, NumberFormat(..)
, UNumberFormat
, withNumberFormat
, wrap
)
where
import Data.Typeable (Typeable)
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
import Foreign.Ptr (FunPtr, Ptr)
import Data.Text.ICU.Internal (newICUPtr)
data UNumberFormat
data MNumberFormat = MNumberFormat {-# UNPACK #-} !(ForeignPtr UNumberFormat)
deriving (Typeable)
newtype NumberFormat = C MNumberFormat
deriving (Typeable)
withNumberFormat :: MNumberFormat -> (Ptr UNumberFormat -> IO a) -> IO a
withNumberFormat :: forall a. MNumberFormat -> (Ptr UNumberFormat -> IO a) -> IO a
withNumberFormat (MNumberFormat ForeignPtr UNumberFormat
col) Ptr UNumberFormat -> IO a
action = forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr UNumberFormat
col Ptr UNumberFormat -> IO a
action
{-# INLINE withNumberFormat #-}
wrap :: IO (Ptr UNumberFormat) -> IO MNumberFormat
wrap :: IO (Ptr UNumberFormat) -> IO MNumberFormat
wrap = forall a i.
(ForeignPtr a -> i) -> FinalizerPtr a -> IO (Ptr a) -> IO i
newICUPtr ForeignPtr UNumberFormat -> MNumberFormat
MNumberFormat FunPtr (Ptr UNumberFormat -> IO ())
unum_close
{-# INLINE wrap #-}
foreign import ccall unsafe "hs_text_icu.h &__hs_unum_close" unum_close
:: FunPtr (Ptr UNumberFormat -> IO ())