I would be very grateful if someone sick enough would explain the situation to me below. It seems to me that Haskell was ready to do some integer type coercion when returning a value from a function. On the other hand, I read that Haskell never converts a type implicitly.
If I type GHCi:
> import Data.Word
> let t :: (Integer, Word32);
t = let { y = fromIntegral (-1) -- line breaks added for readability
; y' :: Integer
; y' = fromIntegral y } in (y', y)
GHCi later informs me that t = (-1,4294967295). But if I restrict the local type yspecifically for Word32:
> let t :: (Integer, Word32);
t = let { y :: Word32
; y = fromIntegral (-1) -- line breaks added for readability
; y' :: Integer
; y' = fromIntegral y } in (y', y)
GHCi will tell me that t = (4294967295,4294967295).
I thought that if the type is tindicated as (Integer, Word32), GHCi will conclude that y' :: Integerand y :: Word32, since the result of the function (y', y). Then a type definition y :: Word32would be completely unnecessary.
, "" Integral - . Int → Word32. Just 1 1 Nothing -1.
SO .