[Haskell-cafe] A few questions on primes generating.

Isaac Dupree isaacdupree at charter.net
Mon Aug 13 17:42:36 EDT 2007


Andrew Coppin wrote:
> Stefan O'Rear wrote:
>> Also, large numbers don't (this is arguably a bug...) have restricted
>> types:
>>
>> stefan at stefans:~$ ghc -e '1000000000000000000 :: Int'
>> -1486618624
>>   
> 
> So many other programming languages allow weird things to happen with 
> numeric overflows... it would be nice if Haskell didn't.

Shall we have a GHC warning if it can detect those cases, either the 
Haskell report bounds or that of the target GHC is currently compiling 
to? (of course someone would have to implement it, and there would 
always be cases it didn't check, and the (non-portable) behavior is 
sometimes desired...)

Hugs often does throw an exception (runtime error) rather than allow Int 
overflow (but not always).

Isaac


More information about the Haskell-Cafe mailing list