[Book] Curious OCaml: Functional Programming in OCaml

Hi!

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.

HTML version: Curious OCaml

PDF version: curious-ocaml/pdfs/new_book.pdf at main · lukstafi/curious-ocaml · GitHub

Website and Markdown original as README: GitHub - lukstafi/curious-ocaml: A curious book about OCaml: logic (types), algebra (values), computation (rewrite semantics), functions (lambda calculus), constraints, monads, algebraic effects, expression.

Enjoy!

Edited to add: a shoutout to Ahrefs for their support!

12 Likes

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?

I hope you do, TBH! :wink:

1 Like

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.

Best Regards.

Thanks a lot for your explanation and for sharing context.

I wish you all the best!

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.

1 Like

GADTs are now covered in chapter 9 (on algebraic effects) – in the first and the last section. Thanks for the motivation!

1 Like