Converting IEEE 754 floating point in Haskell Word32/64 to and from Haskell Float/Double
Simon Marlow mentions another approach in GHC bug 2209 (also linked to from Bryan O’Sullivan’s answer) You can achieve the desired effect using castSTUArray, incidentally (this is the way we do it in GHC). I’ve used this option in some of my libraries in order to avoid the unsafePerformIO required for the FFI marshalling method. … Read more