Return of the Clocks

Timepieces, lesson 3: Keeping time with TVar

Last time, Chris left you with a blank drawing window, and now it’s time to turn it into a clock. This lesson we use

  • the time library to get the time and display it as a string;
  • a TVar from the stm package to give the application some mutable state;
  • some basic concurrency primitives to start a thread that will advance the clock; and
  • the pango package to set the font.

Now we have a clock! Along the way, we talk about the drawing process and the concept of invalidating areas of the window in order to repaint them.

Functortown, lesson 7: The laws of the bifunctors

This lesson is all about the Bifunctor laws and property testing them. Since the Bifunctor laws are similar to the Functor laws, we also spend a good portion of this lesson familiarizing ourselves with aspects of the hedgehog testing library, especially ranges and the concept of shrinking.