[Haskell-cafe] Re: [Haskell] Strictness question

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Tue Jun 7 22:59:28 EDT 2005

 >> To gloss over details: it'll reduce x far enough so it knows that
 >> it's an Integer, but it won't nessesarally compute that integers
 >> value.

 > No, Integers don't contain any lazy components.
 > It statically knows that it's an integer.

I meant that it would reduce to the outermost constructor but 
nessesarally evaluate the rest of the object.

Ok, I actually looked up the implementation of Integer in GHC.

 > -- | Arbitrary-precision integers.
 > data Integer	
 >   = S# Int#                 -- small integers
 > #ifndef ILX
 >   | J# Int# ByteArray#      -- large integers
 > #else
 >   | J# Void BigInteger      -- .NET big ints

You were right and I was wrong, Integers contain no lazy components. 
Perhaps that just highlights the folly of guessing how much actually 
gets evaluated in a lazy language.. :)


More information about the Haskell-Cafe mailing list