Effective Haskell: Chapter 7 Suggestions

The discussion of why 1 'div' 0 isn’t evaluated in lazyIODemo (ePub p 214) could be expanded. The rationale (don’t want to read an entire file if it won’t be used) makes sense, but a bit more on why it isn’t evaluated would help (what would you need to put in the code to force an evaluation?).

When discussing how to fix unsafe (ePub p. 216) it says “I’ll show you two ways that we can address this type of problem”, but this chapter really only shows one way, changing the logic. The end of the section says “I’ll introduce you to the byte string library, which will allow you to write efficient strict IO more idiomatically.” Presumably this is the second solution (use strictness) and it might be helpful to tie this back to the easier statement.

The second bonus exercise description says “The replacement should newline separated pairs of strings”. Something’s missing (“should consist of …”?).

1 Like