What is the difference between Int and Integer?

0xAX picture 0xAX · Aug 7, 2010 · Viewed 69.6k times · Source

In Haskell, what is the difference between an Int and an Integer? Where is the answer documented?

Answer

bcat picture bcat · Aug 7, 2010

"Integer" is an arbitrary precision type: it will hold any number no matter how big, up to the limit of your machine's memory…. This means you never have arithmetic overflows. On the other hand it also means your arithmetic is relatively slow. Lisp users may recognise the "bignum" type here.

"Int" is the more common 32 or 64 bit integer. Implementations vary, although it is guaranteed to be at least 30 bits.

Source: The Haskell Wikibook. Also, you may find the Numbers section of A Gentle Introduction to Haskell useful.