
11 Feb
2016
11 Feb
'16
11:02 a.m.
Hello, I am playing with FFI and I need to extract from a C API a list of pointers. I have two methods available c_get_first_item :: Ptr List -> IO (Ptr Item) c_get_next_item :: Ptr List -> Ptr Item -> IO (Ptr Item) I would like to obtain a [Ptr Item] I try to used whileM but I did not find how to inject the first item in the loop. whileM (return . ( /= nullPtr)) (c_get_next_item list item) the c_get_next_item return a nullPtr when there is no remaining item. what is the haskell way in order to extract a list of pointer using these C methods ? thanks for your help Frederic