[copied to hugs-bugs] You shouldn't hope to get any useful results from Int after an arithmetic overflow since the Haskell report explicitly says that the results are unspecified. If you want predictable results, you should use Integer or Foreign.Int32. The latter is part of the foreign interface extension which is implemented by nhc, ghc and Hugs.
I believe that Hugs is giving a correct answer in this case in that nothing strange happens until after the overflow occurs. Of course the answer is not _useful_ but, as I said, you shouldn't expect useful results after an overflow occurs. I think that GHC may be giving an incorrect answer because I think the 0 should appear in the list but it would take a very careful examination of how the Haskell report specifies the Enum Int instance to be sure. -- Alastair Reid ps When I say 'after an overflow', what I mean is that the value of X is undefined if the value of X depends on the value of Y and Y overflowed. On Friday 13 August 2004 19:39, you wrote: > Using GHC 6.2.1 interpreter, the fragment [minBound :: Int, 0 ..] returns > [-2147483648]. > > Using Hugs, the returned value is the infinite list [-2147483648, 0, > -2147483648, 0, ...]. > > However, I would expect to get [-2147483648, 0]. Similar problems occur > with the other arithmetic sequence functions for Int when the increment is > greater than what is representable in the type. _______________________________________________ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs