Timing Pure Functions

Timing Pure Functions

The timeFunction that you built as you worked through this chapter only supports timing IO actions. Try writing a version of this function that also works for pure values, with the type:

timePureFunction :: Metrics -> String -> a -> IO a

What are the limitations to your implementation function? Are there things that a user of the function could do to ensure that the timing information was better?

Hint 1

Some high level hint text

Hint 2

Some more detailed hint text

Hint 3

Even more detailed hint text

Solution

A complete solution for the exercise