================================================================================
Simple operator usage
================================================================================

f = a + b

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_name
        (variable))
      (operator)
      (exp_name
        (variable)))))

================================================================================
Multiple operators
================================================================================

f = a + b * c

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_infix
        (exp_name
          (variable))
        (operator)
        (exp_name
          (variable)))
      (operator)
      (exp_name
        (variable)))))

================================================================================
Infix expression, single variable
================================================================================

f = a `b` c

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_name
        (variable))
      (exp_ticked
        (exp_name
          (variable)))
      (exp_name
        (variable)))))

================================================================================
Infix expression, compound
================================================================================

f = a `b c + d` e

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_name
        (variable))
      (exp_ticked
        (exp_infix
          (exp_apply
            (exp_name
              (variable))
            (exp_name
              (variable)))
          (operator)
          (exp_name
            (variable))))
      (exp_name
        (variable)))))

================================================================================
Multiple infix expressions
================================================================================

f = a `b` c `d` e

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_name
        (variable))
      (exp_ticked
        (exp_infix
          (exp_name
            (variable))
          (exp_ticked
            (exp_name
              (variable)))
          (exp_name
            (variable))))
      (exp_name
        (variable)))))

================================================================================
Infix expressions have highest precedence
================================================================================

-- should be equivalent to (1 `add` 2) * 3
f = 1 `add` 2 * 3

--------------------------------------------------------------------------------

(purescript
  (comment)
  (function
    name: (variable)
    rhs: (exp_infix
      (exp_infix
        (exp_literal
          (integer))
        (exp_ticked
          (exp_name
            (variable)))
        (exp_literal
          (integer)))
      (operator)
      (exp_literal
        (integer)))))

================================================================================
Section left, operator
================================================================================

f = (_ + 1)
f = (_ >>= pure)

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_section_left
      (wildcard)
      (operator)
      (exp_literal
        (integer))))
  (function
    name: (variable)
    rhs: (exp_section_left
      (wildcard)
      (operator)
      (exp_name
        (variable)))))

================================================================================
Section left, infix expression
================================================================================

f = (_ `add` 1)
f = (_ `flip bind` pure)

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_section_left
      (wildcard)
      (exp_ticked
        (exp_name
          (variable)))
      (exp_literal
        (integer))))
  (function
    name: (variable)
    rhs: (exp_section_left
      (wildcard)
      (exp_ticked
        (exp_apply
          (exp_name
            (variable))
          (exp_name
            (variable))))
      (exp_name
        (variable)))))

================================================================================
Section right, operator
================================================================================

f = (1 + _)
f = (pure =<< _)

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_section_right
      (exp_literal
        (integer))
      (operator)
      (wildcard)))
  (function
    name: (variable)
    rhs: (exp_section_right
      (exp_name
        (variable))
      (operator)
      (wildcard))))

================================================================================
Section right, infix expression
================================================================================

f = (1 `add` _)
f = (pure `identity bind` _)

--------------------------------------------------------------------------------

(purescript
  (function
    name: (variable)
    rhs: (exp_section_right
      (exp_literal
        (integer))
      (exp_ticked
        (exp_name
          (variable)))
      (wildcard)))
  (function
    name: (variable)
    rhs: (exp_section_right
      (exp_name
        (variable))
      (exp_ticked
        (exp_apply
          (exp_name
            (variable))
          (exp_name
            (variable))))
      (wildcard))))

================================================================================
dotdot is a valid operator
================================================================================

f = 1 .. 2

--------------------------------------------------------------------------------

(purescript
  (function
    (variable)
    (exp_infix
      (exp_literal
        (integer))
      (operator)
      (exp_literal
        (integer)))))

================================================================================
equals is NOT a valid operator
================================================================================

f = 1 = 2

--------------------------------------------------------------------------------


(purescript
  (function
    (variable)
    (exp_apply
      (exp_literal
        (integer))
      (ERROR)
      (exp_literal
        (integer)))))
