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