OCaml Cookbook Recipes

The OCaml Cookbook is a place where OCaml developers share how to solve common tasks using packages from the ecosystem.

A task is something that needs to be done inside a project. A recipe is a code sample and explanations on how to perform a task using a combination of open source libraries. Some tasks can be performed using different combination of libraries, each is a different recipe. Tasks don't describe how to use the standard library or language features.

OCaml developers are warmly invited to contribute categories, tasks, and recipes. See the Cookbook section of the CONTRIBUTING.md file in our GitHub repo.

The OCaml guides are recommend reading, for instance recipes handle errors as described in the Error Handling guide.

Command Line

Task
Opam Packages Used
Parse Command Line Arguments

This task has no recipes yet, maybe you want to contribute a recipe!

Using the ANSI Terminal

This task has no recipes yet, maybe you want to contribute a recipe!

Compilation & Linking

Task
Opam Packages Used
Compile and Link to a Bundled C Library

This task has no recipes yet, maybe you want to contribute a recipe!

Generate OCaml Bindings for a C Library

This task has no recipes yet, maybe you want to contribute a recipe!

Concurrency & Parallelism

Parallelism & Multi-Threading

Task
Opam Packages Used
Spawn a Thread and Receive a Response

This task has no recipes yet, maybe you want to contribute a recipe!

Pass Data Between Parallel Threads

This task has no recipes yet, maybe you want to contribute a recipe!

Data Structures & Algorithms

Database

PostgreSQL

Task
Opam Packages Used
PostgreSQL CREATE, INSERT, SELECT

This task has no recipes yet, maybe you want to contribute a recipe!

PostgreSQL Aggregate Query

This task has no recipes yet, maybe you want to contribute a recipe!

PostgreSQL Full Text Search

This task has no recipes yet, maybe you want to contribute a recipe!

Date and Time

Task
Opam Packages Used

Debugging

Task
Opam Packages Used

Encoding

Task
Opam Packages Used

File System

Task
Opam Packages Used
File Size

This task has no recipes yet, maybe you want to contribute a recipe!

Change File Permissions

This task has no recipes yet, maybe you want to contribute a recipe!

Walk File Tree

This task has no recipes yet, maybe you want to contribute a recipe!

Find Files Matching a Pattern

This task has no recipes yet, maybe you want to contribute a recipe!

Graphical User Interfaces

There's nothing in this category yet.

Text Processing

Unicode / UTF-8

Task
Opam Packages Used

Web Programming

Media Types (MIME)

Task
Opam Packages Used
Get MIME Type From String

This task has no recipes yet, maybe you want to contribute a recipe!

Get MIME Type From Filename

This task has no recipes yet, maybe you want to contribute a recipe!

Parse MIME Type of an HTTP Response

This task has no recipes yet, maybe you want to contribute a recipe!

Dealing with HTML

OCaml

Innovation. Community. Security.