🐫 Songs of the OCaml Compiler Part I: A Proxy Project  [Pinned]

Building a hand-rolled simulation environment to demonstrate the classic consensus protocol (Paxos) with the goal of hearing the OCaml compiler "sing" to me; a step towards making my learning visible.

Review of "Real World OCaml – Functional programming for the masses"   [Pinned]

I picked up some OCaml recently. At the start of my challenge (see “Songs of the OCaml Compiler”), I read through most of “Real World OCaml – Functional programming for the masses; 2nd Edition (Oct 2022)” by Anil Madhavapeddy and Yaron Minsky. OCaml’s type system was fresh for me, I’ve never used anything like it. I see its appeal. ...

Real World OCaml Chapters 1-5

Chapter 1: Guided Tour Tooling the book is going to prefer using Base over the standard library that OCaml has. Checks out because one of the authors is a Jane Street senior (Yaron Minsky) and Base is from Jane Street. utop is an improvement from the older ocaml shell Basic Language Syntax operators = can be used for let-binding, can also be used for equality testing, they can be used in the same sentence like so: ...

Real World Ocaml Chapters 11-15

Chapter 11: First-Class Modules Working with First-Class Modules Creating First-Class Modules (packaging) Inference and Anonymous Modules Unpacking first-class modules Functions for Manipulating First-Class Modules Richer First-Class Modules Exposing Types Example: A Query-handling framework Implementing a query handler Dispatching to Multiple Query Handlers Loading and Unloading Query Handlers Living without First-Class Modules OCaml essentially has 2 parts to the language: a core language that is concerned with values and types ...

Real World Ocaml Chapters 16-20

TODO Chapter 16: Concurrent Programming with Async Async Basics Using Let Syntax Ivars and Upon Example: An Echo Server Initial helpers Tail-Calls and Chain of Deferreds Functions that Never Return Improving the Echo Server Example: Searching Definitions with DuckDuckGo Setup URI Handling Parsing JSON Strings Executing an HTTP Client Query Dispatching multiple searches in parallel Exception Handling Monitors Example: Handling exceptions with DuckDuckGo Timeouts, Cancellation, and Choices Working with System Threads Multicore OCaml Thread-Safety and Locking The book introduces us to concurrent programming by talking about the problems of waiting on blocked processes on some sort of IO. ...

Real World OCaml Chapters 6-10

Chapter 6: Variants Basics: Variants, Tuples and Parens Catch-All Cases & Refactoring Combining Records and Variants Embedded Records Variants & Recursive Data Structures Polymorphic Variants Polymorphic variants and Catch-all Cases Use case of using polymorphic variants: Terminal Colors Redux Packaging the code up When to Use Polymorphic Variants Variants are sum types of multiple forms of data, all of them are tagged explicitly. The value this gives is that we can represent complex data and organise the case-analysis of that information. ...