[Haskell-cafe] Deadlock in real number multiplication (Was: Where's the problem ?)

Miguel miguelimo38 at yandex.ru
Thu Jul 5 02:49:17 EDT 2007


R> Another interesting thing I've discovered is:

Prelude>> length [1..1000000]
R> 1000000
Prelude>> Data.List.genericLength [1..1000000]
R> *** Exception: stack overflow

R> Maybe there is something wrong with Integer ? 

No, there is something wrong with genericLength:

Prelude> Data.List.foldl (+) 0 $ map (const 1) [1..1000000] :: Int
*** Exception: stack overflow
Prelude> Data.List.foldl' (+) 0 $ map (const 1) [1..1000000] :: Integer
1000000



More information about the Haskell-Cafe mailing list