# What is an example of a good, modern OCaml codebase that I can learn from?

**URL:** <https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268>\
**Category:** Learning\
**Created:** [February 3, 2022, 12:45am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268 "2022-02-03T00:45:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mimoo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mimoo/32/2900_2.png) [@mimoo](https://discuss.ocaml.org/u/mimoo)\
**Post date:** [February 3, 2022, 12:45am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/1 "2022-02-03T00:45:03Z")

</div>

Question is in the title 🙂

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [February 3, 2022, 1:17am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/2 "2022-02-03T01:17:18Z")

</div>

I would nominate any project by @dbuenzli : he knows how to write the code, also how to write the documentation. Concretely, maybe cmdliner might be nice to look at. Or fmt.

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [February 3, 2022, 2:21am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/3 "2022-02-03T02:21:37Z")

</div>

Also asked in [https://www.reddit.com/r/ocaml/comments/sj4htc/what\_is\_an\_example\_of\_a\_good\_modern\_ocaml/](https://www.reddit.com/r/ocaml/comments/sj4htc/what_is_an_example_of_a_good_modern_ocaml/)

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [February 3, 2022, 7:27am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/4 "2022-02-03T07:27:18Z")

</div>

The “fix” project by Francois Poittier, is also a good choice. I have been hacking on that for the last week, and it’s lovely code. Also powerful ideas and theory there, but really, that isn’t a prerequisite for your question, I’d think. I’s well-written and easy-to-modify: I’m using to hack/hack/hack on Camlp5’s parser-generator, and it’s _great_ fun. And for those who don’t know about the Brzozowski derivative, I highly recommend having a look.

[http://gallium.inria.fr/blog/fixin-your-automata/](http://gallium.inria.fr/blog/fixin-your-automata/)

> **[POTTIER Francois / fix](https://gitlab.inria.fr/fpottier/fix/)**
>
> An OCaml library that provides facilities for memoization and fixed points.

---

<div class="post-metadata">

**Author:** ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)\
**Post date:** [February 3, 2022, 7:56am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/5 "2022-02-03T07:56:12Z")

</div>

I understand good, but what’s the difference between modern and not?

---

<div class="post-metadata">

**Author:** ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Post date:** [February 3, 2022, 10:21am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/6 "2022-02-03T10:21:10Z")

</div>

> [@Chet\_Murthy](#):
>
> I would nominate any project by @dbuenzli

Thanks for the embarassing praise, but I wouldn’t recommend _any_.

Some of the stuff has been written ages ago when the language, the stdlib and the @dbuenzli were quite different. If you want to follow this advice tend to favour more recent projects (look at the `CHANGES.md` for the first date of release).

Also this is mostly libraries so it may not be that interesting to look at (there is however this CRUD [webapp](https://github.com/dbuenzli/hyperbib), but saying I’m happy with the code would be quite a stretch, there’s tons of things to iron out but at some point you have to deliver…).

---

<div class="post-metadata">

**Author:** ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Post date:** [February 3, 2022, 11:10am UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/7 "2022-02-03T11:10:55Z")

</div>

> [@mro](#):
>
> I understand good, but what’s the difference between modern and not?

Modern is a ragbag but if you take it to mean matches the current language capabilities it makes sense.

For example 18 years ago, encoding and using existential types was [quite involved](https://alan.petitepomme.net/cwn/2004.01.13.html#1), but if you needed them that was “good” and “modern” 😂. Nowadays, in “modern” code, this is just a [GADT existential](https://ocaml.org/manual/gadts-tutorial.html) away.

---

<div class="post-metadata">

**Author:** ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)\
**Post date:** [February 3, 2022, 12:13pm UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/8 "2022-02-03T12:13:02Z")

</div>

I wonder nobody mentioned @antron and lambdasoup or dream so far. The new website works that way: [https://github.com/ocaml/v3.ocaml.org-server](https://github.com/ocaml/v3.ocaml.org-server).

Or tyre by @drup.  
Or stuff by @hannes & friends in the mirage ecosystem.

---

<div class="post-metadata">

**Author:** ![mro](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mro/32/2496_2.png) [@mro](https://discuss.ocaml.org/u/mro)\
**Post date:** [February 3, 2022, 4:00pm UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/9 "2022-02-03T16:00:17Z")

</div>

oh – and definitively don’t miss [Share your crazy OCaml code snippet!](https://discuss.ocaml.org/t/share-your-crazy-ocaml-code-snippet/8116)

---

<div class="post-metadata">

**Author:** ![didier-wenzek](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@didier-wenzek](https://discuss.ocaml.org/u/didier-wenzek)\
**Post date:** [February 3, 2022, 9:45pm UTC](https://discuss.ocaml.org/t/what-is-an-example-of-a-good-modern-ocaml-codebase-that-i-can-learn-from/9268/10 "2022-02-03T21:45:23Z")

</div>

+1 for [dream](https://aantron.github.io/dream/) by @antron.

It’s a real pleasure to read and to see the power of just a bunch of types that are glorified functions.
