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. while loop (PICCA Frederic-Emmanuel) ---------------------------------------------------------------------- Message: 1 Date: Thu, 11 Feb 2016 11:02:45 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "beginners@haskell.org" <beginners@haskell.org> Subject: [Haskell-beginners] while loop Message-ID: <a2a20ec3b8560d408356cac2fc148e53b3036...@sun-dag3.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" 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 ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 92, Issue 13 *****************************************