I’m new to Haskell and I’d like to be able to time the runtime of a given function call or snippet of code.
In Clojure I can use ‘time’:
user=> (time
Haskell is lazily evaluated. If your expression doesn't have some side effect (as encoded in the IO monad or the like), then the program doesn't need to actually resolve the expression to a value, and so won't.
To get meaningful numbers out of this, you might try timing print 4
and print expr
and take the difference, in order to remove the overhead of string formatting and IO.