Quick Haskell tip

Posted on August 10, 2011

Last updated on February 12, 2013

I’ve seen frequently on the web, IRC, or stackoverflow, people asking how to time the execution of their haskell functions, and while there are packages for it, there is a simple alternative to them, or to compiling and using time.

Simply fire up ghci with your program, and enter

> :set +s

into the prompt.

Now, after any evaluation of any function, ghc will tell you the time and memory that it took. Enjoy!

Markdown SHA1: c41ce25f0fbc3eee8e8dec114b8023985b04b5ba