# Learning

**URL:** https://discuss.ocaml.org/c/learning/7.md?page=1

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

**Page:** 2

---

## [Hello from a new OCaml learner](https://discuss.ocaml.org/t/hello-from-a-new-ocaml-learner/18396)

<div class="topic-metadata">

**Author:** [@Adithnk](https://discuss.ocaml.org/u/Adithnk)\
**Replies:** 4\
**Last updated:** [July 31, 2026, 4:00pm UTC](https://discuss.ocaml.org/t/hello-from-a-new-ocaml-learner/18396 "2026-07-31T16:00:11Z")

</div>

Hi everyone, I’m Adith from India, and I’ve been learning OCaml over the past couple of months. I started with the NPTEL Functional Programming with OCaml course, worked through Exercism exercises, and recently began b…

---

## [Challenging Claude's creativity with IFS fractals and OCaml](https://discuss.ocaml.org/t/challenging-claudes-creativity-with-ifs-fractals-and-ocaml/18398)

<div class="topic-metadata">

**Author:** [@cedric](https://discuss.ocaml.org/u/cedric)\
**Replies:** 5\
**Last updated:** [July 28, 2026, 8:57am UTC](https://discuss.ocaml.org/t/challenging-claudes-creativity-with-ifs-fractals-and-ocaml/18398 "2026-07-28T08:57:34Z")

</div>

Hello, Back in 2010, during a functional programming course, I wrote a small OCaml program that draws fractals with iterated function systems (IFS), using the graphics library and the chaos game. It is one of my oldest …

---

## [Generating a bills of material for a build](https://discuss.ocaml.org/t/generating-a-bills-of-material-for-a-build/11509)

<div class="topic-metadata">

**Author:** [@mro](https://discuss.ocaml.org/u/mro)\
**Replies:** 9\
**Last updated:** [July 27, 2026, 11:07am UTC](https://discuss.ocaml.org/t/generating-a-bills-of-material-for-a-build/11509 "2026-07-27T11:07:13Z")

</div>

@dbuenzli soonish I will have to provide a software bill of materials and thought of an opam dependency list per release (package names + versions). How would you suggest to assemble such?

---

## [Translating Rust design architecture to OCaml](https://discuss.ocaml.org/t/translating-rust-design-architecture-to-ocaml/18389)

<div class="topic-metadata">

**Author:** [@710Randy](https://discuss.ocaml.org/u/710Randy)\
**Replies:** 2\
**Last updated:** [July 26, 2026, 8:24pm UTC](https://discuss.ocaml.org/t/translating-rust-design-architecture-to-ocaml/18389 "2026-07-26T20:24:10Z")

</div>

I have been trying to make modern Linux tools with OCaml, and one idea that came to mind is the Rust community’s Uutils project. It’s well developed, and specifically, I want to adapt parts of the shadow library to make …

---

## [Any relationship between module-dependent functions and Scala 3?](https://discuss.ocaml.org/t/any-relationship-between-module-dependent-functions-and-scala-3/18326)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 3\
**Last updated:** [July 22, 2026, 2:07pm UTC](https://discuss.ocaml.org/t/any-relationship-between-module-dependent-functions-and-scala-3/18326 "2026-07-22T14:07:35Z")

</div>

Scala 3’s type system is based on something called dependent object types / DOT or path dependent types. This isn’t true dependent type theory afaict. The documentation example is: trait Entry { type Key; val key: Key }…

---

## [Bootstrap compiler source code](https://discuss.ocaml.org/t/bootstrap-compiler-source-code/18377)

<div class="topic-metadata">

**Author:** [@Piero\_Furiesi](https://discuss.ocaml.org/u/Piero_Furiesi)\
**Replies:** 1\
**Last updated:** [July 21, 2026, 9:24pm UTC](https://discuss.ocaml.org/t/bootstrap-compiler-source-code/18377 "2026-07-21T21:24:33Z")

</div>

Just for curiosity: why the source code of the OCaml boostrap compiler (in boot/ocamlc) are not distributed along with it? Is it published somewhere, or is there a paper explaining the requirements an OCaml boostrap com…

---

## [Compiler reproducibility and OCaml](https://discuss.ocaml.org/t/compiler-reproducibility-and-ocaml/18260)

<div class="topic-metadata">

**Author:** [@conroj](https://discuss.ocaml.org/u/conroj)\
**Replies:** 31\
**Last updated:** [July 19, 2026, 11:33am UTC](https://discuss.ocaml.org/t/compiler-reproducibility-and-ocaml/18260 "2026-07-19T11:33:58Z")

</div>

Not to detract from your main point about Rust being massive, but this comparison is not entirely fair: the standard OCaml build uses a binary bootstrap too. An experimental source bootstrap exists, but it will add seve…

---

## [Converting non-literal strings to ('a...'f) CamlinternalFormatBasics.format6](https://discuss.ocaml.org/t/converting-non-literal-strings-to-a-f-camlinternalformatbasics-format6/18367)

<div class="topic-metadata">

**Author:** [@Piero\_Furiesi](https://discuss.ocaml.org/u/Piero_Furiesi)\
**Replies:** 2\
**Last updated:** [July 17, 2026, 6:16pm UTC](https://discuss.ocaml.org/t/converting-non-literal-strings-to-a-f-camlinternalformatbasics-format6/18367 "2026-07-17T18:16:53Z")

</div>

Hi, the OCaml manual says: format\_of\_string can not convert a string argument that is not a literal. If you need this functionality, use the more general Scanf.format\_from\_string function. and Scanf.format\_from\_st…

---

## [Bug in opam create switch/init: can't compile base compiler](https://discuss.ocaml.org/t/bug-in-opam-create-switch-init-cant-compile-base-compiler/18365)

<div class="topic-metadata">

**Author:** [@lie](https://discuss.ocaml.org/u/lie)\
**Replies:** 2\
**Last updated:** [July 17, 2026, 1:57pm UTC](https://discuss.ocaml.org/t/bug-in-opam-create-switch-init-cant-compile-base-compiler/18365 "2026-07-17T13:57:47Z")

</div>

I’ve tried to install opam and i’m with this weird bug where it is stuck in the 22/27 operation (make sh) and I don’t know what causes it. I’ve tried changing apparmor files, reinstalling gcc/make, but nothing works Th…

---

## [Leaking effect handling](https://discuss.ocaml.org/t/leaking-effect-handling/18351)

<div class="topic-metadata">

**Author:** [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Replies:** 17\
**Last updated:** [July 17, 2026, 12:58pm UTC](https://discuss.ocaml.org/t/leaking-effect-handling/18351 "2026-07-17T12:58:29Z")

</div>

It seems that my mental model of effect handlers is sligthly off. Perhaps a good soul here can help me solving that problem. I have code that is morally equivalent to the “User level thread” example in the manual. The h…

---

## [Domains and signal handling](https://discuss.ocaml.org/t/domains-and-signal-handling/18357)

<div class="topic-metadata">

**Author:** [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Replies:** 3\
**Last updated:** [July 16, 2026, 1:22pm UTC](https://discuss.ocaml.org/t/domains-and-signal-handling/18357 "2026-07-16T13:22:50Z")

</div>

Unless I missed a bit from the manual there seem to be no documentation about how domains handle signals which is very sad. Here are a few questions: Should I assume that signals for domains behave like it does for t…

---

## [Dune build @doc with menhir generated files](https://discuss.ocaml.org/t/dune-build-doc-with-menhir-generated-files/18337)

<div class="topic-metadata">

**Author:** [@Nyavlys](https://discuss.ocaml.org/u/Nyavlys)\
**Replies:** 3\
**Last updated:** [July 14, 2026, 9:47am UTC](https://discuss.ocaml.org/t/dune-build-doc-with-menhir-generated-files/18337 "2026-07-14T09:47:14Z")

</div>

Hi, After moving from menhir.20250912 to more recent versions, I have the following error message from odocwhen running dune build @doc Error: While resolving the expansion of include at File "src/scripting/tableParser…

---

## [Ppx rewriter with global state on all compilation units](https://discuss.ocaml.org/t/ppx-rewriter-with-global-state-on-all-compilation-units/18344)

<div class="topic-metadata">

**Author:** [@Piero\_Furiesi](https://discuss.ocaml.org/u/Piero_Furiesi)\
**Replies:** 9\
**Last updated:** [July 12, 2026, 8:53am UTC](https://discuss.ocaml.org/t/ppx-rewriter-with-global-state-on-all-compilation-units/18344 "2026-07-12T08:53:00Z")

</div>

Hi, I made a port of ocaml bytecode to a platform with 15-bit integers. As polymorphic variants are internally represented with an hash number, i need to rewrite their identifiers using a short form, i.e. \`( \[A-Z\] | \[…

---

## [Type error "the type variable 'a cannot be deduced from the type parameters."](https://discuss.ocaml.org/t/type-error-the-type-variable-a-cannot-be-deduced-from-the-type-parameters/18327)

<div class="topic-metadata">

**Author:** [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Replies:** 9\
**Last updated:** [July 9, 2026, 7:40am UTC](https://discuss.ocaml.org/t/type-error-the-type-variable-a-cannot-be-deduced-from-the-type-parameters/18327 "2026-07-09T07:40:30Z")

</div>

Is there a way to type this without having to reveal the implementation of E.t ? module E : sig type 'a t type \_ Effect.t += | Call : (unit -\> 'a) -\> 'a t Effect.t end = struct type 'a t = 'a type \_ Effect.t +…

---

## [Broken symbolic link in cram tests involving dune sites](https://discuss.ocaml.org/t/broken-symbolic-link-in-cram-tests-involving-dune-sites/18333)

<div class="topic-metadata">

**Author:** [@kentookura](https://discuss.ocaml.org/u/kentookura)\
**Replies:** 2\
**Last updated:** [July 8, 2026, 9:45am UTC](https://discuss.ocaml.org/t/broken-symbolic-link-in-cram-tests-involving-dune-sites/18333 "2026-07-08T09:45:23Z")

</div>

My application uses sites. Concretely, when the program runs it copies the contents of the site to an output folder. When running the program in a cram test, I am encountering broken symlinks: $ forester build + Succ…

---

## [Replacing library wrapper modules with single large .ml files. Bad idea?](https://discuss.ocaml.org/t/replacing-library-wrapper-modules-with-single-large-ml-files-bad-idea/18313)

<div class="topic-metadata">

**Author:** [@hask](https://discuss.ocaml.org/u/hask)\
**Replies:** 5\
**Last updated:** [July 1, 2026, 2:10am UTC](https://discuss.ocaml.org/t/replacing-library-wrapper-modules-with-single-large-ml-files-bad-idea/18313 "2026-07-01T02:10:28Z")

</div>

Hi, I’m an Ocaml beginner and I would appreciate feedback about this idea related to information hiding :smiley: Ocaml .mli files offer a great way to declare some definitions as private. However, in a bit larger progra…

---

## [Deterministic hashing](https://discuss.ocaml.org/t/deterministic-hashing/18308)

<div class="topic-metadata">

**Author:** [@kentookura](https://discuss.ocaml.org/u/kentookura)\
**Replies:** 4\
**Last updated:** [June 28, 2026, 4:27pm UTC](https://discuss.ocaml.org/t/deterministic-hashing/18308 "2026-06-28T16:27:33Z")

</div>

I have been using Hashtbl.hash to generate unique ids from a certain datatype in my program. The problem with this is that between runs of the program the same input yields a different hash. This causes cram tests to fai…

---

## [Good code patterns for sharing algorithms on slightly different types](https://discuss.ocaml.org/t/good-code-patterns-for-sharing-algorithms-on-slightly-different-types/18295)

<div class="topic-metadata">

**Author:** [@dlesbre](https://discuss.ocaml.org/u/dlesbre)\
**Replies:** 14\
**Last updated:** [June 28, 2026, 7:44am UTC](https://discuss.ocaml.org/t/good-code-patterns-for-sharing-algorithms-on-slightly-different-types/18295 "2026-06-28T07:44:08Z")

</div>

I’m struggling to find a good code pattern to share algorithms code across slightly different types. For example, a library for sets and maps using a similar tree structure: type set = Leaf | Node of key \\\* set \\\* set t…

---

## [Typechecking module takes time quadratic in the number of submodules](https://discuss.ocaml.org/t/typechecking-module-takes-time-quadratic-in-the-number-of-submodules/18307)

<div class="topic-metadata">

**Author:** [@patrick-nicodemus](https://discuss.ocaml.org/u/patrick-nicodemus)\
**Replies:** 4\
**Last updated:** [June 27, 2026, 6:30pm UTC](https://discuss.ocaml.org/t/typechecking-module-takes-time-quadratic-in-the-number-of-submodules/18307 "2026-06-27T18:30:50Z")

</div>

I tried to compile some generated code the other day, where there was one large file Types.ml with 3700 independent modules inside, about 190k lines of code in that file. Compilation of files depending on Types.ml took a…

---

## [FP architecture patterns and "agentic programming"](https://discuss.ocaml.org/t/fp-architecture-patterns-and-agentic-programming/18257)

<div class="topic-metadata">

**Author:** [@roerick](https://discuss.ocaml.org/u/roerick)\
**Replies:** 3\
**Last updated:** [June 24, 2026, 10:33pm UTC](https://discuss.ocaml.org/t/fp-architecture-patterns-and-agentic-programming/18257 "2026-06-24T22:33:31Z")

</div>

Hi, I’m wondering if the folks here have any thoughts on how some of the FP ecosystem might change with agentic programming, or perhaps change agentic programming. (we can just call it vibecoding, right?) I am barely eve…

---

## [Exceptions and performance](https://discuss.ocaml.org/t/exceptions-and-performance/18288)

<div class="topic-metadata">

**Author:** [@syssan](https://discuss.ocaml.org/u/syssan)\
**Replies:** 2\
**Last updated:** [June 24, 2026, 4:15pm UTC](https://discuss.ocaml.org/t/exceptions-and-performance/18288 "2026-06-24T16:15:42Z")

</div>

I’m trying to understand the performance cost of exceptions. Here is a function reading lines from stdin and returning a list in reverse order: (\*using options\*) let input\_rev () = let rec aux acc = match In\_chann…

---

## [New error using ocaml 5.5.0](https://discuss.ocaml.org/t/new-error-using-ocaml-5-5-0/18284)

<div class="topic-metadata">

**Author:** [@Chimrod](https://discuss.ocaml.org/u/Chimrod)\
**Replies:** 2\
**Last updated:** [June 23, 2026, 7:12pm UTC](https://discuss.ocaml.org/t/new-error-using-ocaml-5-5-0/18284 "2026-06-23T19:12:52Z")

</div>

I have an error when I compile this code with the new release of Ocaml 5.5.0: type leaf (\*\* Fantom type for typing the tree \*) type node (\*\* Fantom type for typing the tree \*) type ('a, 'v) branch = | Leaf : (leaf, …

---

## [How to run cygwin shell on Windows?](https://discuss.ocaml.org/t/how-to-run-cygwin-shell-on-windows/17290)

<div class="topic-metadata">

**Author:** [@Tim](https://discuss.ocaml.org/u/Tim)\
**Replies:** 10\
**Last updated:** [June 22, 2026, 2:37pm UTC](https://discuss.ocaml.org/t/how-to-run-cygwin-shell-on-windows/17290 "2026-06-22T14:37:55Z")

</div>

OCaml 5 seems to sort of support Windows, vaguely. As far as I can see it uses an internal cygwin environment so it’s still keeping Windows at arms length. Presumably that is because so many packages assume Unix. I’m tr…

---

## [Octal character \\0ddd escape code for the ASCII ESC character](https://discuss.ocaml.org/t/octal-character-0ddd-escape-code-for-the-ascii-esc-character/18275)

<div class="topic-metadata">

**Author:** [@pgc](https://discuss.ocaml.org/u/pgc)\
**Replies:** 2\
**Last updated:** [June 21, 2026, 12:40pm UTC](https://discuss.ocaml.org/t/octal-character-0ddd-escape-code-for-the-ascii-esc-character/18275 "2026-06-21T12:40:57Z")

</div>

I’m from a C background so forgive me if this is a stupid question. I was reading Mutability and Imperative Control Flow · OCaml Documentation which has the following example: try print\_endline "Press Escape to exit";…

---

## [Ocamlmklib and arbitrary linker options](https://discuss.ocaml.org/t/ocamlmklib-and-arbitrary-linker-options/18264)

<div class="topic-metadata">

**Author:** [@olafhering](https://discuss.ocaml.org/u/olafhering)\
**Replies:** 0\
**Last updated:** [June 18, 2026, 4:24pm UTC](https://discuss.ocaml.org/t/ocamlmklib-and-arbitrary-linker-options/18264 "2026-06-18T16:24:13Z")

</div>

ocamlmklib was recently changed to fail if called with unrecognized options. This causes regressions. I wonder how to deal with those regressions. It seems ocamlmklib tries to handle rpath linker options, and recognizes…

---

## [Creating an executable depending on a local library with dune](https://discuss.ocaml.org/t/creating-an-executable-depending-on-a-local-library-with-dune/18261)

<div class="topic-metadata">

**Author:** [@jonathandoyle](https://discuss.ocaml.org/u/jonathandoyle)\
**Replies:** 2\
**Last updated:** [June 17, 2026, 9:31am UTC](https://discuss.ocaml.org/t/creating-an-executable-depending-on-a-local-library-with-dune/18261 "2026-06-17T09:31:32Z")

</div>

I am stuck trying to create (with dune) an executable that uses my homemade library. Here is my setup : my root directory has a dune-project file, a lib/ and a /bin subdirectory. Each of those directories has a dune fil…

---

## [MirageOS on NetBSD?](https://discuss.ocaml.org/t/mirageos-on-netbsd/18132)

<div class="topic-metadata">

**Author:** [@eded2556](https://discuss.ocaml.org/u/eded2556)\
**Replies:** 2\
**Last updated:** [June 11, 2026, 8:05pm UTC](https://discuss.ocaml.org/t/mirageos-on-netbsd/18132 "2026-06-11T20:05:35Z")

</div>

Does anyone has tested MirageOS on xen backend with NetBSD host? Note: In the official documentation of MirageOS, requirements point out only to Linux or FreeBSD host.

---

## [Mutable fields of private records](https://discuss.ocaml.org/t/mutable-fields-of-private-records/18213)

<div class="topic-metadata">

**Author:** [@tsnobip](https://discuss.ocaml.org/u/tsnobip)\
**Replies:** 5\
**Last updated:** [June 4, 2026, 8:24am UTC](https://discuss.ocaml.org/t/mutable-fields-of-private-records/18213 "2026-06-04T08:24:29Z")

</div>

Hi, I use \`private\` records from time to time because they are a nice way to show the inside while protecting the instantiation. I’ve noticed something that looks weird to me though, you can’t mutate a mutable field of…

---

## [How to build dune projects with optional dependencies (like C libraries)](https://discuss.ocaml.org/t/how-to-build-dune-projects-with-optional-dependencies-like-c-libraries/18197)

<div class="topic-metadata">

**Author:** [@toots](https://discuss.ocaml.org/u/toots)\
**Replies:** 0\
**Last updated:** [May 30, 2026, 10:43pm UTC](https://discuss.ocaml.org/t/how-to-build-dune-projects-with-optional-dependencies-like-c-libraries/18197 "2026-05-30T22:43:04Z")

</div>

It took me a while to understand how to setup a build system using dune that could have optional packages, e.g. a speex package inside ocaml-xiph that would only build their libraries and executable when pkg-config detec…

---

## [Testing cohttp\_eio request handlers](https://discuss.ocaml.org/t/testing-cohttp-eio-request-handlers/18185)

<div class="topic-metadata">

**Author:** [@mneumann](https://discuss.ocaml.org/u/mneumann)\
**Replies:** 2\
**Last updated:** [May 28, 2026, 4:10pm UTC](https://discuss.ocaml.org/t/testing-cohttp-eio-request-handlers/18185 "2026-05-28T16:10:03Z")

</div>

Hey, I wrote a webservice using cohttp\_eio and then wanted to test it, ideally without having to start a server listening on a network interface. My rough idea was to craft the inputs for the request handler (HTTP verb…

[Previous page](https://discuss.ocaml.org/c/learning/7.md)

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