============================
Values
============================

function x -> ();;
function \#function -> ();;

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (value_pattern)
        body: (unit))))
  (expression_item
    (function_expression
      (match_case
        pattern: (value_pattern)
        body: (unit)))))

============================
Constant patterns
============================

function 1 | +1.0 | - 0b1 | 'x' | "x" | {|x|} | true | () -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (or_pattern
          (number)
          (signed_number)
          (signed_number)
          (character
            (character_content))
          (string
            (string_content))
          (quoted_string
            (quoted_string_content))
          (boolean)
          (unit))
        body: (unit)))))

============================
Typed patterns
============================

function (x : t) -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (typed_pattern
          pattern: (value_pattern)
          type: (type_constructor_path
            (type_constructor)))
        body: (unit)))))

============================
Constructors and tags
============================

function A x | A | `A | `A x -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (or_pattern
          (constructor_pattern
            (constructor_path
              (constructor_name))
            pattern: (value_pattern))
          (constructor_path
            (constructor_name))
          (tag)
          (tag_pattern
            (tag)
            pattern: (value_pattern)))
        body: (unit)))))

============================
Polymorphic variant patterns
============================

function #t -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (polymorphic_variant_pattern
          (type_constructor_path
            (type_constructor)))
        body: (unit)))))

============================
Records, lists and arrays
============================

function {x} | [x] | [|x|] | [|x;y;|] | x :: xs -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (or_pattern
          (record_pattern
            (field_pattern
              (field_path
                (field_name))))
          (list_pattern
            (value_pattern))
          (array_pattern
            (value_pattern))
          (array_pattern
            (value_pattern)
            (value_pattern))
          (cons_pattern
            left: (value_pattern)
            right: (value_pattern)))
        body: (unit)))))

============================
Local open patterns
============================

function M.(A x) | M.[x] -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (or_pattern
          (local_open_pattern
            (module_path
              (module_name))
            pattern: (constructor_pattern
              (constructor_path
                (constructor_name))
              pattern: (value_pattern)))
          (local_open_pattern
            (module_path
              (module_name))
            pattern: (list_pattern
              (value_pattern))))
        body: (unit)))))

============================
Package patterns
============================

function (module M) -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (package_pattern
          (module_name))
        body: (unit)))))

============================
Alias patterns
============================

function x as t -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (alias_pattern
          pattern: (value_pattern)
          alias: (value_pattern))
        body: (unit)))))

============================
Tuple patterns
============================

function x, x, x -> ();;
function ~a:x, ~b, ~(c:int), d -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (tuple_pattern
          (value_pattern)
          (value_pattern)
          (value_pattern))
        body: (unit))))
  (expression_item
    (function_expression
      (match_case
        pattern: (tuple_pattern
          (labeled_tuple_element_pattern
            (label_name)
            pattern: (value_pattern))
          (labeled_tuple_element_pattern
            (label_name))
          (labeled_tuple_element_pattern
            (label_name)
            type: (type_constructor_path
              (type_constructor)))
          (value_pattern))
        body: (unit)))))

============================
Range patterns
============================

function 'a' .. 'z' -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (range_pattern
          left: (character
            (character_content))
          right: (character
            (character_content)))
        body: (unit)))))

============================
Lazy patterns
============================

function lazy x -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (lazy_pattern
          pattern: (value_pattern))
        body: (unit)))))

============================
Parenthesized patterns
============================

function (x) -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (parenthesized_pattern
          (value_pattern))
        body: (unit)))))

============================
Effect patterns
============================

function effect E, k -> ()

---

(compilation_unit
  (expression_item
    (function_expression
      (match_case
        pattern: (effect_pattern
          effect: (constructor_path
            (constructor_name))
          continuation: (value_pattern))
        body: (unit)))))
