module Data.Number.Flint.Groups.Bool.Mat.Instances where

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

import Data.Number.Flint.Groups.Bool.Mat

instance Show BoolMat where
  show :: BoolMat -> String
show BoolMat
x = IO String -> String
forall a. IO a -> a
unsafePerformIO (IO String -> String) -> IO String -> String
forall a b. (a -> b) -> a -> b
$ do
    (BoolMat
_, CString
cs) <- BoolMat -> (Ptr CBoolMat -> IO CString) -> IO (BoolMat, CString)
forall {a}. BoolMat -> (Ptr CBoolMat -> IO a) -> IO (BoolMat, a)
withBoolMat BoolMat
x Ptr CBoolMat -> IO CString
bool_mat_get_str
    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