[Haskell] need help

Ketil Malde ketil+haskell at ii.uib.no
Tue Mar 16 08:49:05 EST 2004


rui yang <r2yang at engmail.uwaterloo.ca> writes:

> I'm a new comer in functional programming,I have defined some
> functions in Haskell and I want to know how much CPU time each
> function need and compare the efficiency of these functions. The
> question is how should I test the CPU time of my function? it seems
> that those functions to call the system clock should be of type IO,
> but my functions don't have IO actions, how should I deal with this
> type conflict?

Two ways; either run your functions from the IO monad, making sure you
are strict enough that you do the work you want to, or use GHC or NHC
profiling options (compile with -prof -auto-all, run with +RTS -p, see
the user's guide for details)

-kzm                
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell mailing list