Re: [Haskell-cafe] Medical Instruments - Jason

2009-11-11 Thread Philippos Apolinarius
Hi, Jason. Thank you for your explanations. They were very useful. In the light of what you said, I modified the programs as shown below (commented lines failed to work). Forcing the C function to return a number, wrapping the returned number in IO,  and printing the number, I succeeded in

Re: [Haskell-cafe] Medical Instruments - Jason

2009-11-11 Thread Ben Millwood
On Wed, Nov 11, 2009 at 6:00 PM, Philippos Apolinarius phi50...@yahoo.ca wrote:  closecport :: Int - IO Int  closecport n= return (fromIntegral (c_closecport (fromIntegral n))) The return here doesn't do what you think it does - semantically, the value of c_closecport is still considered pure

Re: [Haskell-cafe] Medical Instruments - Jason

2009-11-11 Thread Jason Dusek
First of all, I find it striking that you are using the declaration:  foreign import ccall unsafe rs232.h closecport c_closecport :: CInt - CInt and that it actually works. I would think the only workable declaration would be:   foreign import stdcall unsafe rs232.h closecport