===========================
Type variables
===========================

type 'a t = 'a
type '\#if \#then = '\#else
type ('a, 'b) t = 'a
type +'a t = 'a
type !+'a t = 'a
type +!'a t = 'a

---

(compilation_unit
  (type_definition
    (type_binding
      (type_variable)
      (type_constructor)
      (type_variable)))
  (type_definition
    (type_binding
      (type_variable)
      (type_constructor)
      (type_variable)))
  (type_definition
    (type_binding
      (type_variable)
      (type_variable)
      (type_constructor)
      (type_variable)))
  (type_definition
    (type_binding
      (type_variable)
      (type_constructor)
      (type_variable)))
  (type_definition
    (type_binding
      (type_variable)
      (type_constructor)
      (type_variable)))
  (type_definition
    (type_binding
      (type_variable)
      (type_constructor)
      (type_variable))))

===========================
Type constructors
===========================

type t = t
type \#begin = \#end
type t = M.t
type \#try = M.\#with
type t = M(M).t

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (type_constructor_path (type_constructor))))
  (type_definition
    (type_binding
      (type_constructor)
      (type_constructor_path (type_constructor))))
  (type_definition
    (type_binding
      (type_constructor)
      (type_constructor_path
        (extended_module_path (module_name))
        (type_constructor))))
  (type_definition
    (type_binding
      (type_constructor)
      (type_constructor_path
        (extended_module_path (module_name))
        (type_constructor))))
  (type_definition
    (type_binding
      (type_constructor)
      (type_constructor_path
        (extended_module_path
          (extended_module_path (module_name))
          (extended_module_path (module_name)))
        (type_constructor)))))

===========================
Constructed types
===========================

type t = int list
type t = int list list

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (constructed_type
        (type_constructor_path (type_constructor)) (type_constructor_path (type_constructor)))))
  (type_definition
    (type_binding
      (type_constructor)
      (constructed_type
        (constructed_type
          (type_constructor_path (type_constructor))
          (type_constructor_path (type_constructor)))
        (type_constructor_path (type_constructor))))))

===========================
Polymorphic variant types
===========================

type t = [`A | `B of t]
type t = [>
  | t
  | `C
]
type t = [< `A of t & t ]
type t = [< `A > `A ]
type t = M.[`A]

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (polymorphic_variant_type
        (tag_specification (tag))
        (tag_specification
          (tag)
          (type_constructor_path (type_constructor))))))
  (type_definition
    (type_binding
      (type_constructor)
      (polymorphic_variant_type
        (type_constructor_path (type_constructor))
        (tag_specification (tag)))))
  (type_definition
    (type_binding
      (type_constructor)
      (polymorphic_variant_type
        (tag_specification
          (tag)
          (type_constructor_path (type_constructor))
          (type_constructor_path (type_constructor))))))
  (type_definition
    (type_binding
      (type_constructor)
      (polymorphic_variant_type
        (tag_specification (tag))
        (tag))))
  (type_definition
    (type_binding
      (type_constructor)
      (local_open_type
        (extended_module_path (module_name))
        (polymorphic_variant_type
          (tag_specification (tag)))))))

===========================
Package types
===========================

type t = (module T)
type t = M.(module T)

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (package_type
        (module_type_path (module_type_name)))))
  (type_definition
    (type_binding
      (type_constructor)
      (local_open_type
        (extended_module_path (module_name))
        (package_type (module_type_path (module_type_name)))))))

===========================
Function types
===========================

type t = t -> t
type t = t -> t -> t
type t = l:t -> ?l:t -> t

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (function_type
        (type_constructor_path (type_constructor))
        (type_constructor_path (type_constructor)))))
  (type_definition
    (type_binding
      (type_constructor)
      (function_type
        (type_constructor_path (type_constructor)) (function_type
          (type_constructor_path (type_constructor)) (type_constructor_path (type_constructor))))))
  (type_definition
    (type_binding
      (type_constructor)
      (function_type
        (typed_label
          (label_name)
          (type_constructor_path (type_constructor)))
        (function_type
          (typed_label
            (label_name)
            (type_constructor_path (type_constructor)))
          (type_constructor_path (type_constructor)))))))

===========================
Tuple types
===========================

type t = t * t
type t = t * t * t

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (tuple_type
        (type_constructor_path (type_constructor))
        (type_constructor_path (type_constructor)))))
  (type_definition
    (type_binding
      (type_constructor)
      (tuple_type
        (tuple_type
          (type_constructor_path (type_constructor))
          (type_constructor_path (type_constructor)))
        (type_constructor_path (type_constructor))))))

===========================
Aliased types
===========================

type t = t as 't

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (aliased_type
        (type_constructor_path (type_constructor))
        (type_variable)))))

===========================
Parenthesized types
===========================

type t = (t)
type t = M.(t)

---

(compilation_unit
  (type_definition
    (type_binding
      (type_constructor)
      (parenthesized_type
        (type_constructor_path (type_constructor)))))
  (type_definition
    (type_binding
      (type_constructor)
      (local_open_type
        (extended_module_path (module_name))
        (type_constructor_path (type_constructor))))))
