Effective Haskell: — Chapter 10 is difficult to understand for a Haskell Newbie

Hi,

This is the first book that has truly helped to learn Haskell and to develop confidence to write programs in this language. Thanks so much.

I have some feedback about Chapter 10. In the “Building a Basic Metrics System with IORefs” section, I can’t replicate the space leak problems related to the histogram. The timeFunction always ends up measuring zero for every function that I’m capturing metrics for:

The memory usage report doesn’t correlate to the number of files that the application is reading either. I acknowledge that every computer environment is different and that may be the cause for my results. Nevertheless, it would be easier to follow the chapter if I could reproduce the memory leak in my local environment.

A smaller observation is that the displayMetrics function isn’t implemented in the chapter although it is referenced in the code examples. Implementing this function is easy, nevertheless, I thought it might be worth mentioning.

Thanks again for writing this book :heart:

Thanks for the feedback, I’m really glad the book has been helpful. Sorry that this example isn’t working out. I’ll take another look and make sure that I didn’t let an erroneous version of the code slip in by accident. It’s also possible that a newer version of GHC has changed the behavior.

Could you share the GHC version and environment you ran the code in so I can try to replicate the issue there?

Thanks!

Hi Rebecca, sorry for the late reply.

This is my environment’s information:

  • GHC version 8.10.7

I ran the code on macos 12.6. My computer uses an Apple M1 Max chip. I also pushed my code to a public repository: src · main · Enrique Alcántara / haskell-mutable-data-exercise · GitLab