July 2023
Intermediate to advanced
670 pages
17h 13m
English
Write a new function, traverseDirectoryIO, that has the type:
| | traverseDirectoryIO :: FilePath -> (FilePath -> IO a) -> IO [a] |
This function should behave like traverseDirectory’ but should accept a function returning an IO action, rather than a value.
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?
Consider the ...
Read now
Unlock full access