0

I can not find how to treat this typedef struct TF_Status TF_Status; as abstract types and bind to that

the c function is TF_Status* TF_NewStatus();

data TF_Status
tfNewStatus : IO TF_Status 
tfNewStatus = foreign FFI_C "TF_NewStatus" (IO TF_Status)

http://docs.idris-lang.org/en/latest/reference/ffi.html

it complains that When checking argument fty to function foreign: Can't find a value of type FTy FFI_C [] (IO TF_Status)

Cactus
  • 27,075
  • 9
  • 69
  • 149
doofin
  • 508
  • 2
  • 13
  • What is the type of your C function? Why have you tagged both Haskell *and* Idris? What is a `TF_Status`? We need more information to answer this, please add it! – AJF Jul 09 '18 at 09:39

1 Answers1

1

TF_Status* TF_NewStatus(); returns a pointer to a TF_Status when called. So you only need

tfNewStatus : IO Ptr 
tfNewStatus = foreign FFI_C "TF_NewStatus" (IO Ptr)
xash
  • 3,702
  • 10
  • 22