[Haskell-beginners] how to convert an array of foreignPtr a into a list of Ptr a

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Tue Aug 27 07:19:25 UTC 2019


Hello, I am writing some code whcih use FFI.

one of my C functions has an array of pointer has imput

extern HklBinocularsCube *hkl_binoculars_cube_new(int32_t n_spaces,
						                           const HklBinocularsSpace **spaces);


from Haskell, I have a list of ForeignPtr
so my question how can I have something like withForeignPtr for an array of ForeignPtr

[ForeignPtr a] -> ([Ptr a] -> IO b) -> IO b

Thanks for your help.

Frederic


More information about the Beginners mailing list