[Haskell-cafe] question about Data.Binary and Double instance

Brian Alliet brian at brianweb.net
Tue Apr 17 15:44:59 EDT 2007

On Tue, Apr 17, 2007 at 12:18:29PM -0700, David Roundy wrote:
> > machine ghc run on). It might not be fast enough for you though as it
> > still goes via Integer in the conversion.
> It seems like this conversion shouldn't take any time at all, and we ought
> to be able to just copy the memory right over, or just do a unsafeCoerce#
> (which is admittedly unsafe, but in practice between a Word64 and a Double
> should be fine)...

True. I only wrote it that way so I wouldn't have to muck with low
level details between haskell implementations.

The right thing to do for Data.Binary is probably to just peek the
Double off the ForeignPtr in the ByteString, no sense going through
Word64 at all.


More information about the Haskell-Cafe mailing list