[Haskell-cafe] ANNOUNCE: StrictBench 0.1 - Benchmarking code through strict evaluation

Sterling Clover s.clover at gmail.com
Mon Jun 8 23:29:54 EDT 2009

On Jun 8, 2009, at 6:58 AM, Magnus Therning wrote:
> Is there no way to force repeated evaluation of a pure value?  (It'd
> be nice to be able to perform time measurements on pure code so that
> it's possible to compare Haskell implementations of algorithms to
> implementations in other languages, without running into confounding
> factors.)

This perhaps introduces too much inefficiency, but one trick is to  
pack the computation into an existential.
calculate :: Floating b => (forall c. Floating c => c) -> b
calculate = id

This method is used to evaluate the same numeric formula with  
different rounding modes in ieee-utils.



More information about the Haskell-Cafe mailing list