Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. which typefor this FFI call (PICCA Frederic-Emmanuel) ---------------------------------------------------------------------- Message: 1 Date: Sat, 24 Jun 2017 13:47:44 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "Beginners@haskell.org" <Beginners@haskell.org> Subject: [Haskell-beginners] which typefor this FFI call Message-ID: <a2a20ec3b8560d408356cac2fc148e53bb384...@sun-dag3.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" Hello I would like to create a binding for this function [1]. herr_t H5Literate( hid_t group_id, H5_index_t index_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data ) My "only" problem is with the op and op_data part. Here the C op signature[2] op -> herr_t (*H5L_iterate_t)( hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) What I would like to do is to create an Haskell function which allows to return what is contained under the op_data. What I understand from this is that I give the H5Literate function an op function which is executed for each group of my hdf5 file. So the op method is called with the releavant parameters. The op_data can be use to accumulate things during the traversal. H5Literate :: Hid -> Index -> Order -> Maybe HSize -> H5Iterate -> _ -> _ type H5Iterate = Hid -> ByteString -> Info -> _ -> _ So it seems to me that I need to use a State inorder to do the accumulation. For exemple,I want to collect each group names and accumulate then in a list. Somy questioniswhat should be the signature of both function. I have also the fealing that the return type MUST have a Storableinstance. Thanks for your help Frederic [1] https://support.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Iterate [2] https://support.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Visit ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 108, Issue 13 ******************************************