Good meeting! Chapter 10 was pretty short, and we went through it quickly. We did stop to get a better understanding of some bits, making references back to previous chapters. The waitBoth function constructed in terms of STM, was rather tricky. The trick was noticing that there’s a semicolon (sugar for a >>) between waitSTM a2 and retry, not
an orElse. So the retry happens exactly when the waitSTM succeeds. It’s a bit counterintuitive, but it works.
We also convinced ourselves of the differences between the implementation of timeout using ‘race’ and the original one using ‘handleJust’ and ‘bracket’. Not sure which I’d prefer - probably the original one. It depends on whether you care about receiving a special Timeout exception.
I also showed an example of how one can use a bounded channel to feed streaming data from a database query into a Conduit pipeline.
We looked at the library documentation for the async library, to get an idea of what was new that wasn’t talked about in the book. The ‘link’ function that links two arbitrary threads together, so that if one gets killed by an exception, the other one does too, was interesting.
Finally, we moved forward into Chapter 12 on concurrent network servers. We only got through the first section, but it ended with some interesting questions. TJ brought up that the code from the book won’t run in the current version of the library - he had to install an older version. It seems that for some reason the newer versions of the library got rid of the listenOn function, replacing it with several more complex bits of setup.
We’ll continue with Chapter 12 next time. It looks to be pretty fun.