# Learning

**URL:** https://discuss.ocaml.org/c/learning/7.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [About the Learning category](https://discuss.ocaml.org/t/about-the-learning-category/32)

<div class="topic-metadata">

**Author:** [@avsm](https://discuss.ocaml.org/u/avsm)\
**Replies:** 0\
**Last updated:** [May 13, 2017, 12:19pm UTC](https://discuss.ocaml.org/t/about-the-learning-category/32 "2017-05-13T12:19:29Z")

</div>

This category is for anyone learning OCaml. Beginners welcome! Useful resources for getting started: https://realworldocaml.org/ - free on-line book https://try.ocamlpro.com/ - interactive browser tutorial http://o…

---

## [Deploying a Dream web app on a Canadian VPS](https://discuss.ocaml.org/t/deploying-a-dream-web-app-on-a-canadian-vps/18843)

<div class="topic-metadata">

**Author:** [@4GoodHosting](https://discuss.ocaml.org/u/4GoodHosting)\
**Replies:** 4\
**Last updated:** [November 20, 2026, 10:06am UTC](https://discuss.ocaml.org/t/deploying-a-dream-web-app-on-a-canadian-vps/18843 "2026-11-20T10:06:10Z")

</div>

I’m getting ready to deploy a small Dream web app for a client in Canada, and it will store some customer details. PIPEDA covers most private businesses here, and BC public bodies and Quebec’s Law 25 add stricter rules a…

---

## [\[λ calculus\] Case do not need lambdas](https://discuss.ocaml.org/t/calculus-case-do-not-need-lambdas/18881)

<div class="topic-metadata">

**Author:** [@SpiceGuid](https://discuss.ocaml.org/u/SpiceGuid)\
**Replies:** 0\
**Last updated:** [November 17, 2026, 4:20pm UTC](https://discuss.ocaml.org/t/calculus-case-do-not-need-lambdas/18881 "2026-11-17T16:20:32Z")

</div>

That is not an OCaml post, it’s rather an “extended” pure λ calculus. Since i learned pure λ calculus i know that if-then-else is ifte ≡ p a b ↦ p a b But what if we extend pure λ calculus with let ? Using λ inste…

---

## [Matching variant types with ppxlib](https://discuss.ocaml.org/t/matching-variant-types-with-ppxlib/18708)

<div class="topic-metadata">

**Author:** [@sevens](https://discuss.ocaml.org/u/sevens)\
**Replies:** 7\
**Last updated:** [November 11, 2026, 5:43pm UTC](https://discuss.ocaml.org/t/matching-variant-types-with-ppxlib/18708 "2026-11-11T17:43:27Z")

</div>

Howdy, I’m relatively new to OCaml and have been writing some projects in my spare time, and I’ve realized I’m not big on writing nigh identical code for each case of a variant type if I’m doing similar operations for ea…

---

## [Opam and nixos: is there an alternative to nix-shell?](https://discuss.ocaml.org/t/opam-and-nixos-is-there-an-alternative-to-nix-shell/13726)

<div class="topic-metadata">

**Author:** [@ttamttam](https://discuss.ocaml.org/u/ttamttam)\
**Replies:** 9\
**Last updated:** [November 10, 2026, 4:10pm UTC](https://discuss.ocaml.org/t/opam-and-nixos-is-there-an-alternative-to-nix-shell/13726 "2026-11-10T16:10:54Z")

</div>

Hello. This question is maybe more related to NixOS than to OCaml, but I’m asking here, because it’s also about opam use in NixOS, and for sure, some of you will know. I managed to install and use conf-libclang on NixO…

---

## [A Hardcaml port of Niklaus Wirth's Project Oberon RISC5 machine runs DOOM at 15 fps](https://discuss.ocaml.org/t/a-hardcaml-port-of-niklaus-wirths-project-oberon-risc5-machine-runs-doom-at-15-fps/18768)

<div class="topic-metadata">

**Author:** [@zxygentoo](https://discuss.ocaml.org/u/zxygentoo)\
**Replies:** 0\
**Last updated:** [November 10, 2026, 10:05am UTC](https://discuss.ocaml.org/t/a-hardcaml-port-of-niklaus-wirths-project-oberon-risc5-machine-runs-doom-at-15-fps/18768 "2026-11-10T10:05:45Z")

</div>

Most of this work was done a couple of months back; only recently did I find the time to tidy things up. (I drafted this write-up myself; Claude Opus checked and polished it as I’m not a native English speaker.) I’ve …

---

## [Stack vs List Performance](https://discuss.ocaml.org/t/stack-vs-list-performance/17875)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 10\
**Last updated:** [November 7, 2026, 6:36pm UTC](https://discuss.ocaml.org/t/stack-vs-list-performance/17875 "2026-11-07T18:36:21Z")

</div>

I found this exercise in a data structures and algorithms textbook/interview prep book. The idea of the exercises is that towers\_of\_hanoi should take a natural number n and return the sequence of moves that is appropria…

---

## [Can ocamel run in Termux?](https://discuss.ocaml.org/t/can-ocamel-run-in-termux/18689)

<div class="topic-metadata">

**Author:** [@zMatrix7](https://discuss.ocaml.org/u/zMatrix7)\
**Replies:** 2\
**Last updated:** [November 6, 2026, 11:57pm UTC](https://discuss.ocaml.org/t/can-ocamel-run-in-termux/18689 "2026-11-06T23:57:02Z")

</div>

~/z/abc $ pkg search ghc Checking availability of current mirror: \[\] https://mirrors.nju.edu.cn/termux/apt/termux-main: ok Sorting… Done Full Text Search… Do…

---

## [Migration of js\_of\_ocaml code](https://discuss.ocaml.org/t/migration-of-js-of-ocaml-code/18659)

<div class="topic-metadata">

**Author:** [@Chimrod](https://discuss.ocaml.org/u/Chimrod)\
**Replies:** 2\
**Last updated:** [October 29, 2026, 9:27am UTC](https://discuss.ocaml.org/t/migration-of-js-of-ocaml-code/18659 "2026-10-29T09:27:10Z")

</div>

Hello, I’m updating some old code written with js\_of\_ocaml, and I have an error in the compilation with the latest library. This small part of the code does not compile anymore: open Js\_of\_ocaml type message = unit ty…

---

## [How to achieve implicit state without using classes and objects](https://discuss.ocaml.org/t/how-to-achieve-implicit-state-without-using-classes-and-objects/18582)

<div class="topic-metadata">

**Author:** [@rvdalen](https://discuss.ocaml.org/u/rvdalen)\
**Replies:** 6\
**Last updated:** [October 20, 2026, 5:49am UTC](https://discuss.ocaml.org/t/how-to-achieve-implicit-state-without-using-classes-and-objects/18582 "2026-10-20T05:49:26Z")

</div>

Hi everyone, I am new to OCaml and I am trying to write my own parser library just for fun. The easiest way to start of course is explicitly passing the updated parser state around. For example: let my\_parser (st: To…

---

## [Offering One-on-One OCaml Tutoring](https://discuss.ocaml.org/t/offering-one-on-one-ocaml-tutoring/18622)

<div class="topic-metadata">

**Author:** [@Adithnk](https://discuss.ocaml.org/u/Adithnk)\
**Replies:** 0\
**Last updated:** [October 18, 2026, 6:57am UTC](https://discuss.ocaml.org/t/offering-one-on-one-ocaml-tutoring/18622 "2026-10-18T06:57:01Z")

</div>

Hi everyone! I’m Adith, an OCaml learner, open-source contributor, and one-on-one tutor. I’ve been helping students learn OCaml and functional programming, and I’d like to connect with more university students who could…

---

## ["Parameter 'SDL\_CreateTextureFromSurface(): surface' is invalid" Issue with a successfully created surface from tsdl-image](https://discuss.ocaml.org/t/parameter-sdl-createtexturefromsurface-surface-is-invalid-issue-with-a-successfully-created-surface-from-tsdl-image/18615)

<div class="topic-metadata">

**Author:** [@CatPhanta](https://discuss.ocaml.org/u/CatPhanta)\
**Replies:** 3\
**Last updated:** [October 16, 2026, 3:07am UTC](https://discuss.ocaml.org/t/parameter-sdl-createtexturefromsurface-surface-is-invalid-issue-with-a-successfully-created-surface-from-tsdl-image/18615 "2026-10-16T03:07:25Z")

</div>

I’ve been experimenting with Tsdl lately and wanted to try tsdl-image. However I kept getting this error which I couldn’t find any fix for. I only saw that this occurs with NULL surfaces or dangling pointers which is not…

---

## [Tutorial on GADTs](https://discuss.ocaml.org/t/tutorial-on-gadts/14040)

<div class="topic-metadata">

**Author:** [@raphael-proust](https://discuss.ocaml.org/u/raphael-proust)\
**Replies:** 35\
**Last updated:** [October 7, 2026, 8:13am UTC](https://discuss.ocaml.org/t/tutorial-on-gadts/14040 "2026-10-07T08:13:54Z")

</div>

I’ve written a three-part tutorial on GADTs. The first part shows the very basic. It is intended for anyone who already knows OCaml but hasn’t written a GADT before. The second part is a collection of different techniq…

---

## [\[ANN\] tinybox: 150 classic games (Pong to Quake) and Apps, in OCaml, and more](https://discuss.ocaml.org/t/ann-tinybox-150-classic-games-pong-to-quake-and-apps-in-ocaml-and-more/18569)

<div class="topic-metadata">

**Author:** [@aryx](https://discuss.ocaml.org/u/aryx)\
**Replies:** 3\
**Last updated:** [October 7, 2026, 1:52am UTC](https://discuss.ocaml.org/t/ann-tinybox-150-classic-games-pong-to-quake-and-apps-in-ocaml-and-more/18569 "2026-10-07T01:52:53Z")

</div>

Hi, I made something. Well Claude made something, my first vibe coded project :slight\_smile: An ode to code, 150 classic video games (from Pong to Quake), 50 classic apps (from VisiCalc and TurboPascal to Office and …

---

## [Q: module dependent class bindings?](https://discuss.ocaml.org/t/q-module-dependent-class-bindings/18581)

<div class="topic-metadata">

**Author:** [@jhw](https://discuss.ocaml.org/u/jhw)\
**Replies:** 9\
**Last updated:** [October 6, 2026, 10:59pm UTC](https://discuss.ocaml.org/t/q-module-dependent-class-bindings/18581 "2026-10-06T22:59:02Z")

</div>

Messing around with module dependent functions, I discovered that class bindings in OCaml 5.5 cannot be module dependent. To illustrate (does not compile): module type S = sig type t val show: t -\> string end module N =…

---

## [Scope of an effect's result](https://discuss.ocaml.org/t/scope-of-an-effects-result/18586)

<div class="topic-metadata">

**Author:** [@Mohan\_Radhakrishnan](https://discuss.ocaml.org/u/Mohan_Radhakrishnan)\
**Replies:** 1\
**Last updated:** [October 6, 2026, 3:32pm UTC](https://discuss.ocaml.org/t/scope-of-an-effects-result/18586 "2026-10-06T15:32:10Z")

</div>

I have summarised the problem in the title but I am not sure if that is correct. My problem is that the loop needs the result from the effect. The reason is that I need the same doc for inserting again. update\_contents i…

---

## [\[ANN\] IX, a full OS (kernel, toolchain, vcs, ...) in OCaml](https://discuss.ocaml.org/t/ann-ix-a-full-os-kernel-toolchain-vcs-in-ocaml/18570)

<div class="topic-metadata">

**Author:** [@aryx](https://discuss.ocaml.org/u/aryx)\
**Replies:** 3\
**Last updated:** [October 3, 2026, 3:30pm UTC](https://discuss.ocaml.org/t/ann-ix-a-full-os-kernel-toolchain-vcs-in-ocaml/18570 "2026-10-03T15:30:28Z")

</div>

Hi, It is my pleasure to announce IX, a full operating system written in OCaml (by Claude Code). It is a continuation of two of my past projects, principia softwarica and XiX. IX is an ARM emulator, a kernel, a shell, …

---

## [A line-by-line translation of the OCaml runtime from C to Rust](https://discuss.ocaml.org/t/a-line-by-line-translation-of-the-ocaml-runtime-from-c-to-rust/18247)

<div class="topic-metadata">

**Author:** [@mbacarella](https://discuss.ocaml.org/u/mbacarella)\
**Replies:** 23\
**Last updated:** [September 24, 2026, 3:38pm UTC](https://discuss.ocaml.org/t/a-line-by-line-translation-of-the-ocaml-runtime-from-c-to-rust/18247 "2026-09-24T15:38:15Z")

</div>

The Rust community owes the OCaml community a debt of gratitude, the first Rust compiler was written in OCaml. In this post we rewrite the OCaml runtime in Rust. Consider it our down payment on repaying the debt. …

---

## [\[ANN\] 2nd release elm\_playground (a game engine for beginners)](https://discuss.ocaml.org/t/ann-2nd-release-elm-playground-a-game-engine-for-beginners/18552)

<div class="topic-metadata">

**Author:** [@aryx](https://discuss.ocaml.org/u/aryx)\
**Replies:** 0\
**Last updated:** [September 22, 2026, 2:04pm UTC](https://discuss.ocaml.org/t/ann-2nd-release-elm-playground-a-game-engine-for-beginners/18552 "2026-09-22T14:04:46Z")

</div>

It is my pleasure, again, to announce the second release of elm\_playground, an OCaml package that allows you to easily create pictures, animations, and even video games in a portable way using an API that really simplifi…

---

## [Liquidsoap 2.5.x: a practical study of OCaml 5.x concurrency](https://discuss.ocaml.org/t/liquidsoap-2-5-x-a-practical-study-of-ocaml-5-x-concurrency/18525)

<div class="topic-metadata">

**Author:** [@toots](https://discuss.ocaml.org/u/toots)\
**Replies:** 0\
**Last updated:** [September 11, 2026, 11:16pm UTC](https://discuss.ocaml.org/t/liquidsoap-2-5-x-a-practical-study-of-ocaml-5-x-concurrency/18525 "2026-09-11T23:16:19Z")

</div>

\[Full disclosure: some of the code and content linked below was done with the help of automated tools. This post is not.\] After a few years holding off on it, it was finally time to do the migration to OCaml 5 for the l…

---

## [Opam-nix and the solo5 toolchain](https://discuss.ocaml.org/t/opam-nix-and-the-solo5-toolchain/18512)

<div class="topic-metadata">

**Author:** [@RaoulHC](https://discuss.ocaml.org/u/RaoulHC)\
**Replies:** 4\
**Last updated:** [September 8, 2026, 9:45pm UTC](https://discuss.ocaml.org/t/opam-nix-and-the-solo5-toolchain/18512 "2026-09-08T21:45:28Z")

</div>

I’m trying have a go with MirageOS following the uniker.nl site, but I’m using nixos with opam-nix so am running into issues with the solo5 toolchain. Opam-nix has always worked quite nicely for me with normal packages, …

---

## [Modular explicit forms (as, type parameters)](https://discuss.ocaml.org/t/modular-explicit-forms-as-type-parameters/18511)

<div class="topic-metadata">

**Author:** [@smuenzel](https://discuss.ocaml.org/u/smuenzel)\
**Replies:** 1\
**Last updated:** [September 6, 2026, 6:46pm UTC](https://discuss.ocaml.org/t/modular-explicit-forms-as-type-parameters/18511 "2026-09-06T18:46:15Z")

</div>

Are the following forms for modular explicit planned to be supported? val x : ((module A : A)) -\> unit val x' : ((module A : A) as 'a) -\> 'a t -\> unit val x'' : (module A : A) t -\> A.t -\> unit Right now, it seems that …

---

## [Dependent if expressions without dependent types](https://discuss.ocaml.org/t/dependent-if-expressions-without-dependent-types/18506)

<div class="topic-metadata">

**Author:** [@didier-wenzek](https://discuss.ocaml.org/u/didier-wenzek)\
**Replies:** 0\
**Last updated:** [September 3, 2026, 9:58am UTC](https://discuss.ocaml.org/t/dependent-if-expressions-without-dependent-types/18506 "2026-09-03T09:58:40Z")

</div>

This post on Haskell for all shows an insighful use of Church encoding to implement dependent if expressions without dependent types. The following OCaml code type checks and works: # let example bool = if\_then\_else b…

---

## [Email and smtp for Mirage](https://discuss.ocaml.org/t/email-and-smtp-for-mirage/18455)

<div class="topic-metadata">

**Author:** [@aguluman](https://discuss.ocaml.org/u/aguluman)\
**Replies:** 6\
**Last updated:** [September 2, 2026, 8:05am UTC](https://discuss.ocaml.org/t/email-and-smtp-for-mirage/18455 "2026-09-02T08:05:41Z")

</div>

Hello @hannes This is a side questions, I am not 100% certain as I do not remember correctly, But did you create a mail or smtp (postfix) stuff in OCaml for mirage ecosystem? Apologies for sending it here. Once you r…

---

## [Ocamlmklib called without \`.ml\`/\`.cm\*\` files](https://discuss.ocaml.org/t/ocamlmklib-called-without-ml-cm-files/18502)

<div class="topic-metadata">

**Author:** [@vrotaru](https://discuss.ocaml.org/u/vrotaru)\
**Replies:** 1\
**Last updated:** [September 2, 2026, 4:18am UTC](https://discuss.ocaml.org/t/ocamlmklib-called-without-ml-cm-files/18502 "2026-09-02T04:18:51Z")

</div>

I have a question. If I call ocamlmklib like this ocamlmklib -o foo\_stubs -cclib -lfoo foo\_stub.o No .cma/.cmxa library is generated. But when I call it like this ocamlmklib -o foo\_stubs -cclib -lfoo empty.ml foo\_stub…

---

## [Struct, sig, do ... -\> begin?](https://discuss.ocaml.org/t/struct-sig-do-begin/18493)

<div class="topic-metadata">

**Author:** [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Replies:** 3\
**Last updated:** [September 1, 2026, 3:51am UTC](https://discuss.ocaml.org/t/struct-sig-do-begin/18493 "2026-09-01T03:51:32Z")

</div>

We have various syntactic structures that contain blocks of code, eg: for ... do end module M = struct end module type MT = sig end We also have begin...end which seems to be a synonym for (...). Is there some reaso…

---

## [Hardcaml Networking Library - FPGA Project](https://discuss.ocaml.org/t/hardcaml-networking-library-fpga-project/18488)

<div class="topic-metadata">

**Author:** [@LeEmperor](https://discuss.ocaml.org/u/LeEmperor)\
**Replies:** 0\
**Last updated:** [August 31, 2026, 12:26am UTC](https://discuss.ocaml.org/t/hardcaml-networking-library-fpga-project/18488 "2026-08-31T00:26:24Z")

</div>

General Kenobi Greetings. My name is Bo Purtell, and I’m an aspiring senior at the University of Florida. Wanted to share a little project I’ve been working on over the course of the last year being a small networking …

---

## [Monomorphic client values](https://discuss.ocaml.org/t/monomorphic-client-values/18452)

<div class="topic-metadata">

**Author:** [@categoryExplorer](https://discuss.ocaml.org/u/categoryExplorer)\
**Replies:** 2\
**Last updated:** [August 26, 2026, 8:08am UTC](https://discuss.ocaml.org/t/monomorphic-client-values/18452 "2026-08-26T08:08:39Z")

</div>

I’m an Eliom beginner and get the error “The types of client values must be monomorphic from its usage or from its type annotation”. Here is my current example: let%server add\_item\_form = let open Html.D in let inp …

---

## [How to bind opaque types with Ctypes in a type-safe way?](https://discuss.ocaml.org/t/how-to-bind-opaque-types-with-ctypes-in-a-type-safe-way/3712)

<div class="topic-metadata">

**Author:** [@gndl](https://discuss.ocaml.org/u/gndl)\
**Replies:** 4\
**Last updated:** [August 24, 2026, 10:47am UTC](https://discuss.ocaml.org/t/how-to-bind-opaque-types-with-ctypes-in-a-type-safe-way/3712 "2026-08-24T10:47:04Z")

</div>

In order to bind opaque types, I use the void pointers solution like this : type t = unit ptr let t = ptr void But this does not guarantee the safety of the types. Is there a way to bind opaque types in a type-…

---

## [Newbie Question: Utop showing types with /2 suffix using Base](https://discuss.ocaml.org/t/newbie-question-utop-showing-types-with-2-suffix-using-base/18462)

<div class="topic-metadata">

**Author:** [@Icarium](https://discuss.ocaml.org/u/Icarium)\
**Replies:** 2\
**Last updated:** [August 18, 2026, 7:56pm UTC](https://discuss.ocaml.org/t/newbie-question-utop-showing-types-with-2-suffix-using-base/18462 "2026-08-18T19:56:35Z")

</div>

I’m fairly new to ocaml and am starting real world ocaml. I’ve gone through the installation steps and have created an .ocamlinit file with the following contents: #require "core.top";; #require "ppx\_jane";; open Base;;…

[Next page](https://discuss.ocaml.org/c/learning/7.md?page=1)
