
On 21/09/17 19:57, Edward Kmett wrote:
hWaitForInput stdin 4294968296
is using fromInteger, not fromIntegral.fromInteger is the member of Num. fromIntegral is defined in terms of it and toInteger.
Deprecating fromIntegral would do nothing to the example you offered at all as it isn't being called.
Ah, here is the misunderstanding. It is not the call to to hWaitForInput that is overflowing. hWaitForInput takes an `Int`, and so passing 4294968296 to it is perfectly fine (on 64-bit platforms). As described in the linked bug https://ghc.haskell.org/trac/ghc/ticket/14262, the overflow is in the code that implements hWaitForInput, ready :: FD -> Bool -> Int -> IO Bool ready fd write msecs = do r <- throwErrnoIfMinus1Retry "GHC.IO.FD.ready" $ fdReady (fdFD fd) (fromIntegral $ fromEnum $ write) (fromIntegral msecs) in the `fromIntegral msecs`. I provided the `hWaitForInput 4294968296` bit only to give an easily reproducible example of how `fromIntegral` results in a significant bug. I realise now that the `4294968296` is why you brought up the topic of integer literals (which confused me a bit).
Like it or not the existing numeric types in the Haskell ecosystem wrap, and changing this behavior would have non-trivial ramifications for almost all Haskell source code written to date.
I did not propose to change the behaviour of any existing function. I said: " * fromInteger / fromIntegral - unchanged semantics, but emitting a deprecation warning " Niklas