# What :\> does in OCaml?

**URL:** <https://discuss.ocaml.org/t/what-does-in-ocaml/5658>\
**Category:** Learning\
**Created:** [April 30, 2020, 6:51am UTC](https://discuss.ocaml.org/t/what-does-in-ocaml/5658 "2020-04-30T06:51:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucaszanella](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/lucaszanella/32/2163_2.png) [@lucaszanella](https://discuss.ocaml.org/u/lucaszanella)\
**Post date:** [April 30, 2020, 6:51am UTC](https://discuss.ocaml.org/t/what-does-in-ocaml/5658/1 "2020-04-30T06:51:43Z")

</div>

I’ve come across

` let cast x = (x :> (unit, write_error) result Lwt.t)`

[here](https://github.com/mirage/mirage-tcpip/blob/master/src/tcp/flow.ml#L614)

and this operator `:>` is not in pervasives and I couldn’t find on google/don’t know how to find, because it ignores the `:>` in the search.

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [April 30, 2020, 7:09am UTC](https://discuss.ocaml.org/t/what-does-in-ocaml/5658/2 "2020-04-30T07:09:10Z")

</div>

This is a explicit type coercion from a subtype to a supertype. See for instance [https://ocaml.org/releases/4.10/htmlman/objectexamples.html#s:using-coercions](https://ocaml.org/releases/4.10/htmlman/objectexamples.html#s:using-coercions) for more explanations .

---

<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:** [April 30, 2020, 3:04pm UTC](https://discuss.ocaml.org/t/what-does-in-ocaml/5658/3 "2020-04-30T15:04:17Z")

</div>

Another example of `:>` being used for upcasting: [https://ocaml.org/releases/4.10/htmlman/privatetypes.html#ss:private-types-abbrev](https://ocaml.org/releases/4.10/htmlman/privatetypes.html#ss:private-types-abbrev)

And it also works for upcasting values of polymorphic variants:

```auto
type t = [`t]
type u = [t | `u]

let t: t = `t
let u: u = (t :> u)

```
