How can I get a list or array from C block in Haskell's inline-c? In other words, how to construct complex data in C and work with it in Haskell. Something like this:
foo :: IO [Int]
foo = do
what? <- [C.block| <what?> {
ints = calloc(10, sizeof(int));
// ...
return <what?>;
} |]
return <what?>
I could wrap a pointer and a size in some Haskell type, but I'd like to work with the list in Haskell, print it, encode in JSON, etc.