[Haskell-cafe] Forcing recomputation

Todd Wilson twilson at csufresno.edu
Wed Nov 19 07:39:37 UTC 2014


I'm curious: is there a reliable way to force Haskell to recompute a
function application instead of sharing the result of the forced
thunk? For example, suppose I have a function f and two arguments e1
and e2, and I want to compare the time it takes to compute f e1 vs. f
e2, but ghci reports that each takes 0.00 sec (i.e., less than 0.005
sec) to compute. The traditional approach would be to compute each
value a large number of times so that the total time becomes
significant, except that all of the ways I can think of to do that in
Haskell don't actually recompute the function application, but rather
compute it once and share, or otherwise optimize away the redundant
computation.

Todd Wilson, PhD
Department of Computer Science
California State University, Fresno


More information about the Haskell-Cafe mailing list