1 Jun
2006
1 Jun
'06
10:54 p.m.
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. Thanks.
2 Jun
2 Jun
2:32 p.m.
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
7163
Age (days ago)
7164
Last active (days ago)
1 comments
2 participants
participants (2)
-
Ivan Tikhonov -
Simon Marlow