Ivan Tikhonov wrote:
Hello.I have 4 bytes long String and i want to convert it to Float. How can i do this in Haskell? Don't want to use Ptr's.
Try this:
> :m +Data.Array.IO Data.Word
> x <- newListArray (0,3) [0,0,40,66] :: IO (IOUArray Int Word8)
> y <- castIOUArray x :: IO (IOUArray Int Float)
> readArray y 0 >>= print
42.0
Cheers,
Simon
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
