Module Syncom.Associativity

Description for the associativity of user-defined operators.

type t = private
  1. | Left_associative
  2. | Right_associative
  3. | Non_associative

The type of annotation for the associativity of an infix operator.

Let f be an infix operator and a1, a2, and a3 be arguments. Then,

  • if f is left-associative, then a1 f a2 f a3 is parsed as (a1 f a2) f a3
  • if f is right-associative, then a1 f a2 f a3 is parsed as a1 f (a2 f a3)
  • if f is non-associative, then a1 f a2 f a3 is a syntax error.

Constructors

val left_associative : t

left_associative is Left_associative.

val right_associative : t

right_associative is Right_associative.

val non_associative : t

non_associative is Non_associative.

Predicates and Comparisons

val is_left_associative : t -> bool

is_left_associative f is true if and only if f is Left_associative.

val is_right_associative : t -> bool

is_right_associative f is true if and only if f is Right_associative.

val is_non_associative : t -> bool

is_non_associative f is true if and only if f is Non_associative.

Instances

include Support.Eq.EQ with type t := t
val equal : t -> t -> bool

equal a b is true if and only if a and b are equal. This should satisfy the following properties:

  • Reflexivity: equal a a = true
  • Symmetry: equal a b is equivalent to equal b a
  • Transitivity: if equal a b = true and equal b c = true, then equal a c = true
val (=) : t -> t -> bool

Operator alias of equal.

val (<>) : t -> t -> bool

Negation of operator (=).