module Data.Number.Flint.Arb.Instances ( Arb (..) ) where import Test.QuickCheck import System.IO.Unsafe import Foreign.C.String import Foreign.Marshal.Alloc ( free ) import Data.Char import Data.Number.Flint.Arb instance Show Arb where show :: Arb -> String show Arb x = IO String -> String forall a. IO a -> a unsafePerformIO (IO String -> String) -> IO String -> String forall a b. (a -> b) -> a -> b $ do (Arb _, CString cs) <- Arb -> (Ptr CArb -> IO CString) -> IO (Arb, CString) forall {a}. Arb -> (Ptr CArb -> IO a) -> IO (Arb, a) withArb Arb x ((Ptr CArb -> IO CString) -> IO (Arb, CString)) -> (Ptr CArb -> IO CString) -> IO (Arb, CString) forall a b. (a -> b) -> a -> b $ \Ptr CArb x -> Ptr CArb -> CLong -> ArbStrOption -> IO CString arb_get_str Ptr CArb x CLong 16 ArbStrOption arb_str_no_radius String s <- CString -> IO String peekCString CString cs CString -> IO () forall a. Ptr a -> IO () free CString cs String -> IO String forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return String s