On Sunday, June 2, 2013 at 5:02 PM, Tommy Thorn wrote:
Yes, that was it. The dell was a 32 bit system, and the desktop a 64. I
changed everything from Int to Integer, and now both agree. Thanks for the
pointer.
Isn't that just terrible? I hate the fact that Haskell was defined to neither trap the overflow
or just treat everything as Integer [like Scheme]. A sacrifice of program safety in the name
of efficiency.
I disagree with this choice and posit that a clever implementation can minimize the cost
of the overflow checking in most relevant cases.
I wish this fatal flaw would be reconsidered for the next major revision.
Tommy
In addition to Haskell already having an arbitrary-width integer type called Integer, consider the case where you have some program that basically boils down to
f :: Int -> Int
f x = {- some super-complicated mathematical expression -}
f can only have bounds checks eliminated if the values of the inputs are known in advance. How often are you really going to know that? If you do something like
main = do
x <- read <$> getLine
print $ f x
then you have to put all the bounds checks in *anyway*.