RE: Straightforward conversion from Int - Word

2002-02-27 Thread Simon Marlow
Simon Marlow notes: But fromIntegral *does* do the right thing, doesn't it? Numeric.showHex (fromIntegral (-1 :: Int32) :: Word32) 0x Interesting. The fact that this fooled Julian as well as me suggests the behavior needs to be better documented. Interestingly,

RE: Straightforward conversion from Int - Word

2002-02-26 Thread Simon Marlow
PROTECTED] Subject: RE: Straightforward conversion from Int - Word I've found this annoying in the past, and have resorted to hitting it on the head (GHC-specifically) with a blunt instrument: intToNat :: Int - Word intToNat (I# i#) = W# (unsafeCast# i#) This probably defeats

Re: Straightforward conversion from Int - Word

2002-02-26 Thread Jan-Willem Maessen
Simon Marlow notes: But fromIntegral *does* do the right thing, doesn't it? Numeric.showHex (fromIntegral (-1 :: Int32) :: Word32) 0x Interesting. The fact that this fooled Julian as well as me suggests the behavior needs to be better documented. Interestingly, hugs yields