[Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

Bo Herlin bo at gcab.net
Wed Apr 13 09:49:44 EDT 2005


Hmm, too simple :-P   ...Thanks

Henning Thielemann wrote:
> 
> On Wed, 13 Apr 2005, Bo Herlin wrote:
> 
>> Hi
>>
>> How come
>>
>>> foldr1 min [(maxBound::Int) % 1,1 % 2]
>>
>> 2147483647 % 1
> 
> 
> I guess that
>   foldr1 min == minimum
> 
>> but
>>
>>> foldr1 min [2147483647 % 1,1 % 2]
>>
>> 1 % 2
>>
>> Why???
> 
> 
> The first one certainly causes an overflow with machine word Ints 
> whereas 2147483647 is an Integer and thus all other numbers are 
> interpreted as Integers.
> 


More information about the Haskell-Cafe mailing list