Straightforward conversion from Int <-> Word

Jan-Willem Maessen jmaessen@alum.mit.edu
Tue, 26 Feb 2002 09:52:06 -0500


Simon Marlow notes:
> But fromIntegral *does* do the right thing, doesn't it?
> 
>   > Numeric.showHex (fromIntegral (-1 :: Int32) :: Word32) ""
>   "0xffffffff"

Interesting.  The fact that this fooled Julian as well as me suggests
the behavior needs to be better documented.  Interestingly, hugs yields
an error.  I'm going to follow up in more detail to haskell, as this
is really about the behavior of "fromInteger", and has nothing to do
with Word32 or Int32 per se at all.

-Jan