Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Joel Reymont
If I don't cast then how do I convert this code? doubleToInts d = runST ( do arr - newDoubleArray (1,2) writeDoubleArray arr 1 d i1 - readIntArray arr 1 i2 - readIntArray arr 2 return (i1,i2)) Or can I just read an array of ints from the double array using the

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Ketil Malde
Joel Reymont [EMAIL PROTECTED] writes: If I don't cast then how do I convert this code? Uh, what is wrong with divMod? *Main Data.Word (100::Word64) `divMod` (2^32) (2,1410065408) doubleToInts d = runST ( [...] This will only give you a headache. :-) -k -- If I haven't seen

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Udo Stenzel
joel reymont wrote: I don't understand the syntax needed to create a new double or float array with newArray from Data.Array.MArray. I also don't yet understand how to cast that double array to read ints from it. doubleToInts d = runST ( do arr - newDoubleArray (1,2)

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Ketil Malde
Joel Reymont [EMAIL PROTECTED] writes: I must be missing something because I don't think the code below converts a double. Yes, sorry, my bad. I was (and is) confused about what you wanted to do. -k -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Joel Reymont
I'm just trying to replicate the example using the fresh syntax that does not use readDoubleArray, readIntArray, etc. On Oct 14, 2005, at 4:32 PM, Ketil Malde wrote: Yes, sorry, my bad. I was (and is) confused about what you wanted to do. -- http://wagerlabs.com/

[Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-13 Thread joel reymont
Folks, Are there any examples on using STUArray and friends? I'm trying to convert the following bit of code which uses deprecated features. I don't understand the syntax needed to create a new double or float array with newArray from Data.Array.MArray. I also don't yet understand how to cast

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-13 Thread Tomasz Zielonka
On 10/13/05, joel reymont [EMAIL PROTECTED] wrote: Folks, Are there any examples on using STUArray and friends? I'm trying to convert the following bit of code which uses deprecated features. I don't understand the syntax needed to create a new double or float array with newArray from