# What are some libraries you almost always use?

**URL:** <https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165>\
**Category:** Learning\
**Tags:** library\
**Created:** [January 26, 2021, 8:31am UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165 "2021-01-26T08:31:02Z")\
**Posts on this page:** 7\
**Page:** 2

<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 16, 2021, 8:49pm UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/21 "2021-02-16T20:49:23Z")

</div>

> [@leostera](#):
>
> Hard and easy are completely subjective

If it’s subjective then why do you say the API is hard to use ? It brings nothing to the discussion and becomes a baseless claim which is precisely the start of myth building.

Personally I don’t think hard and easy are subjective. It can be _contextual_ but for each context you can specify criterions to assess the level of hardness which is precisely what I did in my reply to demonstrate why I think it’s not for the context of the working ocaml programmer.

---

<div class="post-metadata">

**Author:** ![UnixJunkie](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/unixjunkie/32/638_2.png) [@UnixJunkie](https://discuss.ocaml.org/u/UnixJunkie)\
**Post date:** [February 17, 2021, 6:50am UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/22 "2021-02-17T06:50:15Z")

</div>

Instead of ranting against Cmdliner

> **[dbuenzli/cmdliner](https://github.com/dbuenzli/cmdliner)**
>
> Declarative definition of command line interfaces for OCaml

you can try some alternatives in opam.

I think Daniel has a style, and his style can be recognized in all his libraries.  
Either you like his style of API design and heavy use of types, either you don’t.

The newcomer alternative:

> **[rbardou/clap](https://github.com/rbardou/clap/)**
>
> Command-Line Argument Parsing, imperative style with a consumption mechanism.

My personal hack, for fast development of executables with a CLI that must be correctly used, but still easy to change:

> **[UnixJunkie/minicli](https://github.com/UnixJunkie/minicli)**
>
> Minimalist OCaml library for command line parsing. Contribute to UnixJunkie/minicli development by creating an account on GitHub.

Conservative people still use this one:  
[https://caml.inria.fr/pub/docs/manual-ocaml/libref/Stdlib.Arg.html](https://caml.inria.fr/pub/docs/manual-ocaml/libref/Stdlib.Arg.html)  
I think that once you have a working example, Arg is bearable.

If you don’t like any of those, then write your own, publish it in open-source and contribute to the fantastic and always changing OCaml ecosystem bazaar. 😃

---

<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 17, 2021, 7:44am UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/23 "2021-02-17T07:44:06Z")

</div>

> [@UnixJunkie](#):
>
> Either you like his style of API design and heavy use of types, either you don’t.

I’d be curious where you see _heavy_ use of types ?

I do use types to design APIs because it is a strong organizing and compositional tool.

But most of the time I eschew more advanced type level programming tricks (e.g. phantom types) because they tend to hamper usability (e.g. unreadable error messages, unflexible code motion, etc.) for little returns.

> [@UnixJunkie](#):
>
> I think that once you have a working example, Arg is bearable.

That’s an interesting comment because I thought about it but forgot to mention it in my assessment above. Like `Cmdliner` when I need to use `Arg` I go back to a previous example, cut and paste it and start from there…

---

<div class="post-metadata">

**Author:** ![raphael-proust](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/raphael-proust/32/415_2.png) [@raphael-proust](https://discuss.ocaml.org/u/raphael-proust)\
**Post date:** [February 17, 2021, 7:48am UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/24 "2021-02-17T07:48:29Z")

</div>

> [@leostera](#):
>
> Hard and easy are completely subjective and rely on your body of knowledge and experience.

There are multiple things one does when one “uses an API.”

One thing that is somewhat difficult is to figure out how to use multiple functions one-after-the-other to do what you want. Wait, how do I make this arg optional? Uh, the type system says I have only partially applied something?

One thing that is somewhat easy is to make sure you haven’t forgotten something, you haven’t mixed up two functions, etc. In short: that you haven’t misused the library. This is somewhat easy because you can lean on the type checker! The library defines a tightly typed playground within which there is one way to do one thing and anything else will get you a compiler error.

There are some libraries that are much easier on the first part (where you can write code that compiles easily) but much harder on the second part (where you can write code that fails at runtime in difficult to debug).

---

<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 17, 2021, 10:48pm UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/25 "2021-02-17T22:48:37Z")

</div>

> [@dbuenzli](#):
>
> as command line  
> tools grew in complexity over the last decade which is to have specific command lines syntaxes for `tool object verb` not just `tool cmd` .

Boy, this thread’s gone really off-topic, but hey, at least I get to learn about great stuff like this! Looking forward to this!

---

<div class="post-metadata">

**Author:** ![dromas](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@dromas](https://discuss.ocaml.org/u/dromas)\
**Post date:** [February 23, 2021, 8:02am UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/26 "2021-02-23T08:02:36Z")

</div>

> I don’t use Dune

I’m glad not being alone 🙂

---

<div class="post-metadata">

**Author:** ![Alexina](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/alexina/32/2785_2.png) [@Alexina](https://discuss.ocaml.org/u/Alexina)\
**Post date:** [March 12, 2021, 3:37pm UTC](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/27 "2021-03-12T15:37:48Z")

</div>

Great and useful information. I appreciate your answers, guys!

[Previous page](https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165.md?page=1)
