Today, 2023-10-25, at 1830 UTC (11:30 am PDT, 2:30 pm EDT, 7:30 pm BST, 20:30 CEST, …) we are streaming the thirteenth episode of the Haskell Unfolder live on YouTube.
Open recursion is a technique for defining objects in Haskell whose behaviour can be adjusted after they have been defined. It can be used to do some form of object-oriented programming in Haskell, and is also an interesting technique in its own right.
In the episode we discuss two approaches: we first introduce something that is reminiscent of the
this keyword in OOP languages, and then we introduce something more akin to the
super keyword. We list the examples that we discuss in the episode below as interactive programs that you can step through at your own pace; doing so can be quite useful in understanding how these programs work (these are generated using visualize-cbn).
First, the version of the counter without
faster (we didn’t step through this in the episode itself):
Next, the version where we do call
And finally the version where we introduce
mixin (which we called
(.+) in the episode):
About the Haskell Unfolder
The Haskell Unfolder is a YouTube series about all things Haskell hosted by Edsko de Vries and Andres Löh, with episodes appearing approximately every two weeks. All episodes are live-streamed, and we try to respond to audience questions. All episodes are also available as recordings afterwards.
We have a GitHub repository with code samples from the episodes.