# \[ANN\] containers 2.0+alpha1

**URL:** <https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454>\
**Category:** Community\
**Tags:** stdlib, release, announce\
**Created:** [January 21, 2018, 10:17pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454 "2018-01-21T22:17:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![c-cube](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/c-cube/32/1727_2.png) [@c-cube](https://discuss.ocaml.org/u/c-cube)\
**Post date:** [January 21, 2018, 10:17pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/1 "2018-01-21T22:17:21Z")

</div>

Dear camel riders,

I have the pleasure to announce that containers 2.0+alpha1 is being released.

[containers](https://github.com/c-cube/ocaml-containers) is a modular, lightweight, and performant extension of the standard library. Version 2.0 introduces a monomorphic mode (thanks to @jpdeplaix) that is designed to prevent errors caused by the polymorphic “magic” operators such as `(=)`. This breaking release is also the occasion to switch to dune, and to fix some inconsistencies in the API (mostly printers).

If you use containers, please give a try to 2.0+alpha1 and report any issue on the bucktracker!

tag: [https://github.com/c-cube/ocaml-containers/releases/tag/2.0%2Balpha1](https://github.com/c-cube/ocaml-containers/releases/tag/2.0%2Balpha1)  
changelog: [https://github.com/c-cube/ocaml-containers/blob/2.0%2Balpha1/CHANGELOG.adoc](https://github.com/c-cube/ocaml-containers/blob/2.0%2Balpha1/CHANGELOG.adoc)

---

<div class="post-metadata">

**Author:** ![n4323](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@n4323](https://discuss.ocaml.org/u/n4323)\
**Post date:** [January 22, 2018, 12:44pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/2 "2018-01-22T12:44:00Z")

</div>

opam suggests the new alpha version for an automatic upgrade of containers. is this intended? (rather than only testing with explicit opam pin for now?)

---

<div class="post-metadata">

**Author:** ![n4323](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@n4323](https://discuss.ocaml.org/u/n4323)\
**Post date:** [January 22, 2018, 1:01pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/3 "2018-01-22T13:01:32Z")

</div>

i tried a bit of updating of a project to 2.0. the monomorphic equality change requires some adjustments in quite a few places. i would do them for current projects but probably not for old projects. what’s a good way to keep old projects working without too much overhead when i need to go back to them in the future?

a brute-force solution would be a new package name containers2 but that seems like overkill. maybe there is some other way for me to keep my old projects working?

---

<div class="post-metadata">

**Author:** ![c-cube](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/c-cube/32/1727_2.png) [@c-cube](https://discuss.ocaml.org/u/c-cube)\
**Post date:** [January 22, 2018, 1:22pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/4 "2018-01-22T13:22:16Z")

</div>

I think you can `open Pervasives` after opening Containers to void the monomorphic shadowing, at least for a start.

---

<div class="post-metadata">

**Author:** ![n4323](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@n4323](https://discuss.ocaml.org/u/n4323)\
**Post date:** [January 22, 2018, 1:32pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/5 "2018-01-22T13:32:11Z")

</div>

would that still keep e.g. `CCList` shadowing `List` from the stdlib?

---

<div class="post-metadata">

**Author:** ![c-cube](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/c-cube/32/1727_2.png) [@c-cube](https://discuss.ocaml.org/u/c-cube)\
**Post date:** [January 22, 2018, 1:46pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/6 "2018-01-22T13:46:55Z")

</div>

You should try it, but I believe so.

---

<div class="post-metadata">

**Author:** ![grayswandyr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/grayswandyr/32/94_2.png) [@grayswandyr](https://discuss.ocaml.org/u/grayswandyr)\
**Post date:** [January 23, 2018, 1:17pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/7 "2018-01-23T13:17:35Z")

</div>

Hi,  
as far as I’m concerned, I had a bunch of fixes to make but that’s OK, and it’s indeed better anyway.

Now `=` is to be replaced by a given `equal` but AFAICT there is no replacement for `<>` other than `not @@ equal`, or is there? No `nequal`?

---

<div class="post-metadata">

**Author:** ![c-cube](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/c-cube/32/1727_2.png) [@c-cube](https://discuss.ocaml.org/u/c-cube)\
**Post date:** [January 23, 2018, 1:51pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/8 "2018-01-23T13:51:09Z")

</div>

> as far as I’m concerned, I had a bunch of fixes to make but that’s OK,  
> and it’s indeed better anyway.

Cool! @jpdeplaix is the one to thank for this, really.

> Now `=` is to be replaced by a given `equal` but AFAICT there is no  
> replacement for `<>` other than `not @@ equal`, or is there? No  
> `nequal`

Not really. It’s a bit inconvenient but it’s harder to have combinators for nequal, I think.

---

<div class="post-metadata">

**Author:** ![zozozo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/zozozo/32/59_2.png) [@zozozo](https://discuss.ocaml.org/u/zozozo)\
**Post date:** [January 23, 2018, 4:30pm UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/9 "2018-01-23T16:30:56Z")

</div>

> [@grayswandyr](#):
>
> Now = is to be replaced by a given equal but AFAICT there is no replacement for \<\> other than not @@ equal, or is there? No nequal?

Personally, I always forget whether the negation of `=` is `<>` or `!=`, so I prefer to use `not`, that way I’m sure, ^^

---

<div class="post-metadata">

**Author:** ![grayswandyr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/grayswandyr/32/94_2.png) [@grayswandyr](https://discuss.ocaml.org/u/grayswandyr)\
**Post date:** [January 24, 2018, 8:19am UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/10 "2018-01-24T08:19:32Z")

</div>

Well I don’t forget it, I don’t even think about it and it’s true I found a few `!=` here and there in some code I wrote with colleagues. I didn’t `git blame` to see who was to be shouted at 🙂  
But here all polymorphic operators are hidden so this `not @@ ...` precaution would not necessarily be needed any more.  
Of course, writing combinators for negated functions is a problem.

---

<div class="post-metadata">

**Author:** ![n4323](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@n4323](https://discuss.ocaml.org/u/n4323)\
**Post date:** [January 24, 2018, 10:30am UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/11 "2018-01-24T10:30:49Z")

</div>

This mostly works. I do

```auto
open Containers
open! Pervasives

```

The code changes still required for containers1 code are those for the labeled equality or comparison arguments in some functions. So even when foregoing the monomorphic operators, some manual work is still required in each source file to make a containers1 codebase work on containers2.

---

<div class="post-metadata">

**Author:** ![anon72795300](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon72795300](https://discuss.ocaml.org/u/anon72795300)\
**Post date:** [January 24, 2018, 11:29am UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/12 "2018-01-24T11:29:12Z")

</div>

How should someone pin the alpha version? Clone and pin the local one, or can it be pinned on a URL?

---

<div class="post-metadata">

**Author:** ![jpdeplaix](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jpdeplaix/32/780_2.png) [@jpdeplaix](https://discuss.ocaml.org/u/jpdeplaix)\
**Post date:** [January 24, 2018, 11:52am UTC](https://discuss.ocaml.org/t/ann-containers-2-0-alpha1/1454/13 "2018-01-24T11:52:39Z")

</div>

The alpha version is available through opam.  
Just do `opam upgrade containers` if no installed packages rely on containers1.  
Otherwise you will need to either install it on a new switch or remove/fix the packages that need containers1.
