I’m happy to announce a translation of my Functional Programming (in OCaml) lectures into a textbook format, modernized to cover algebraic effects, is complete!
Claude Opus 4.5 did the bulk of the work; GPT-5.2 wrote chapter 10 and tackled the toughest challenges.
Many thanks for sharing this with such a great generosity!
I went through the TOC and beginning of each chatpter and can say I am
quite excited about discovering the content and pretty sure I’ll learn
something form each chapter.
One thing I did look for and did not really find is explanations about
GADTs. I literally grepped for GADT in the repo and did find a few
occurrences, but just to explain how effects work.
Do you intend to add something about GADTs at some point?
Thank you for the kind words! GADTs hadn’t fallen into the scope of the lectures (therefore book). Said scope was to dig into the aspects by which I was idiosyncratically exposed to FP. I had an outlet for thinking about GADTs via my PhD project, and the lectures at the time were procrastination / burnout prevention wrt. that… So it’s something that’s possible, but haven’t occurred to me before.
I’m really enjoying this. Lots of bits that I don’t quite get, and some that I do. I don’t think that’s a translation issue, just my bad math/logic. Lots here to study. Added it to my phone home screen. Thank you.
I tasked Claude Opus 4.6 with writing Chapter 12 of Curious OCaml covering Category Theory, and I’m happy with the result. I wanted to include a Category Theory chapter from the start – not to share anything specific but to learn it as I lacked familiarity. I did nudge Claude to mention a few things that might not get covered otherwise: Galois connections as a theory of concepts, and reification / reflection.
The chapter has only very toy examples, not like the more valuable worked out examples of the other chapters. But I think that’s fine – the purpose of Chapter 12 is to make Category Theory less scary, more relatable.
Also, the PDF rendering should now be somewhat improved. The new version is available at the original links.
Chapters 1-8 and 11 went through three passes. I asked Claude Code to translate my old slides directly from the TeXmacs sources to not lose any information into a textbook. (I might have tried both Claude Code and Codex, don’t remember, picked Claude anyway). The result of the first pass was dry so I asked Claude to add more filler to make the text more textbook-like. The third pass was asking GPT to do an editorial review, but IIRC it only added the “in this chapter, you’ll learn” sections.
Chapters 9 and 12 are written for scratch for the textbook version, and chapter 10 is heavily rewritten from the lectures version. For Chapters 9 and 10, I asked both Claude Code and GPT Codex to (re)write them, via a few-sentences prompt. Claude’s result was better for Ch 9, GPT’s for Ch 10. Then I did a few iterations pointing out things I didn’t like. For Chapter 12, I first chatted with Claude in the web UI, with my first prompt being: “See the book under this link, would a chapter combining Category Theory and GADTs be a good idea?” We chatted for a while with my prompts being short and its responses longer. I can share this conversation if you want. At the end I asked Claude to write a plan for the chapter and then asked Claude Code to implement that plan.
Getting to “first edition” chapters 1 to 11 took around 4 working days, plus a bit under half a working day for images with Gemini. Getting chapter 12 took maybe half or 2/3 of a working day. I realize there’s discrepancy between the time and the process I describe above, I would need to dig into records to see where the time went…
So are there any plans to explain the mathematical theory of GADT’s as you did with polynomials and ADT’s? It really does seem like trying to study it will lead to burnout! Maybe explaining use of the toolchain would be more down to earth. It’s a been a lucid insightful read so far.
You are teaching me here. It’s a nice find! I will ask Claude if we can incorporate your link to give chapter 12 more depth, but myself I have limited expertise.