package riot

  1. Overview
  2. Docs
type 'a t

A unique reference.

A value of `'a t` won't be created twice (but can be shared/copied), which makes it ideal for coordination between processes.

Normally, you'd use a `'a Ref.t` to identify outgoing/incoming message pairs, but they can also be used for type-equalities. If two refs of type `'a Ref.t` and `'b Ref.t` are equal, then you can use `Ref.type_equal` to obtain a type-level witness that proves that `'a` and `'b` are equal.

val make : unit -> 'a t

`make ()` creates a new unique ref. The type of the ref may be inferred from context or explicitly set.

val pp : Stdlib.Format.formatter -> 'a t -> unit
val equal : 'a t -> 'b t -> bool

`equal ref1 ref2` returns true if both references are the same, regardless of the type they hold.

If the types are different, you may want to use `type_equal` instead to prove type equality.

val type_equal : 'a 'b. 'a t -> 'b t -> ('a, 'b) Stdlib.Type.eq option

`type_equal refA refB` proves that `'a` and `'b` are equals if the underlying refs are also equal.


Innovation. Community. Security.