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

Henning Thielemann lemming at henning-thielemann.de
Wed Apr 13 08:42:06 EDT 2005


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