[Haskell-cafe] "computational time" always 0.0 in this example...

Philippa Cowderoy flippa at flippac.org
Thu Dec 7 09:37:57 EST 2006

On Thu, 7 Dec 2006, Lennart wrote:

> Hi,
> with the following code, I want to measure the time being needed to execute
> the algorithm. But the result is always 0.0.

You need to do something to force the result of a, or it'll never actually 
get evaluated. Depending on the type in question, seq may or may not be 
enough. Printing it'll make you pay the cost of show, too.

flippa at flippac.org

There is no magic bullet. There are, however, plenty of bullets that
magically home in on feet when not used in exactly the right circumstances.

More information about the Haskell-Cafe mailing list