What does the “+” in “type t<+'a>” for Js.Promise mean?

I just looked at Js.Promise | ReScript API and was wondering about the strange plus-sign before the type variable:

type t<+'a>

It does typecheck in https://rescript-lang.org/try but what does it mean?

it means the type is covariant.

You can read more about it in this blog post, the syntax is in OCaml, but the type system is exactly the same.

2 Likes