{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}
module Data.Number.Flint.Acb.Instances where

import System.IO.Unsafe
import Foreign.C.String
import Foreign.Marshal.Alloc ( free )

import Data.Number.Flint.Arb
import Data.Number.Flint.Acb

instance Show Acb where
  show :: Acb -> String
show Acb
x = forall a. IO a -> a
unsafePerformIO forall a b. (a -> b) -> a -> b
$ do
    (Acb
_, CString
cs) <- forall {a}. Acb -> (Ptr CAcb -> IO a) -> IO (Acb, a)
withAcb Acb
x forall a b. (a -> b) -> a -> b
$ \Ptr CAcb
x -> Ptr CAcb -> CLong -> ArbStrOption -> IO CString
acb_get_strn Ptr CAcb
x CLong
16 ArbStrOption
arb_str_no_radius
    String
s <- CString -> IO String
peekCString CString
cs
    forall a. Ptr a -> IO ()
free CString
cs
    forall (m :: * -> *) a. Monad m => a -> m a
return String
s