================================================================================
type: basic
================================================================================

type A = A
type A a = A a a A a
type A = A A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (name))
    (type_synomym
      (name)
      (type_params
        (variable))
      (apply
        (apply
          (apply
            (apply
              (name)
              (variable))
            (variable))
          (name))
        (variable)))
    (type_synomym
      (name)
      (apply
        (name)
        (name)))))

================================================================================
type: two tycons
================================================================================

type A = A A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (apply
        (name)
        (name)))))

================================================================================
type: promoted constructor
================================================================================

type A = ' A
type A = 'A
type A = 'A.A
type A = 'A.A.A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (promoted
        (constructor)))
    (type_synomym
      (name)
      (promoted
        (constructor)))
    (type_synomym
      (name)
      (promoted
        (qualified
          (module
            (module_id))
          (constructor))))
    (type_synomym
      (name)
      (promoted
        (qualified
          (module
            (module_id)
            (module_id))
          (constructor))))))

================================================================================
type: list plain
================================================================================

type A = []
type A = [A a]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (prefix_list))
    (type_synomym
      (name)
      (list
        (apply
          (name)
          (variable))))))

================================================================================
type: parens
================================================================================

type A = ()
type A = (,)
type A = (,,)
type A = (->)
type A = (A.A.->)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unit))
    (type_synomym
      (name)
      (prefix_tuple))
    (type_synomym
      (name)
      (prefix_tuple))
    (type_synomym
      (name)
      (prefix_id
        (operator)))
    (type_synomym
      (name)
      (prefix_id
        (qualified
          (module
            (module_id)
            (module_id))
          (operator))))))

================================================================================
type: varsym
================================================================================

type A = A ++ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (operator)
        (name)))))

================================================================================
type: consym
================================================================================

type A = A :++ A ':++ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (constructor_operator)
        (infix
          (name)
          (promoted
            (constructor_operator))
          (name))))))

================================================================================
type: list cons
================================================================================

type A = A : A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (constructor_operator)
        (name)))))

================================================================================
type: promoted list cons
================================================================================

type A = A ': A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (promoted
          (constructor_operator))
        (name)))))

================================================================================
type: promoted list nil
================================================================================

type A = '[]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (promoted
        (empty_list)))))

================================================================================
type: list literal
================================================================================

type A = [A a, 'A, a]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (list
        (apply
          (name)
          (variable))
        (promoted
          (constructor))
        (variable)))))

================================================================================
type: promoted list literal
================================================================================

type A = ' [A a, 'A, a]
type A = '[a]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (promoted
        (list
          (apply
            (name)
            (variable))
          (promoted
            (constructor))
          (variable))))
    (type_synomym
      (name)
      (promoted
        (list
          (variable))))))

================================================================================
type: qualified consym
================================================================================

type A = A A.A.:++ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (qualified
          (module
            (module_id)
            (module_id))
          (constructor_operator))
        (name)))))

================================================================================
type: promoted consym
================================================================================

type A = A ':++ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (promoted
          (constructor_operator))
        (name)))))

================================================================================
type: qualified promoted consym
================================================================================

type A = A 'A.:++ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (promoted
          (qualified
            (module
              (module_id))
            (constructor_operator)))
        (name)))))

================================================================================
type: qualified ticked
================================================================================

type A = A `A.A` A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (infix_id
          (qualified
            (module
              (module_id))
            (name)))
        (name)))))

================================================================================
type: promoted tuple
================================================================================

type A = '(A a, A)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (promoted
        (tuple
          (apply
            (name)
            (variable))
          (name))))))

================================================================================
type: promoted prefix tuple
================================================================================


type A = '(,,,)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (promoted
        (prefix_tuple)))))

================================================================================
type: equality
================================================================================

type A = A ~ A
type A = A ~~ A
type A = ∀ a . (A a ~ A a) => A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (operator)
        (name)))
    (type_synomym
      (name)
      (infix
        (name)
        (operator)
        (name)))
    (type_synomym
      (name)
      (forall
        (quantified_variables
          (variable))
        (context
          (parens
            (infix
              (apply
                (name)
                (variable))
              (operator)
              (apply
                (name)
                (variable))))
          (name))))))

================================================================================
type: infix promoted consym after apply
================================================================================

type A = a a ': a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (apply
          (variable)
          (variable))
        (promoted
          (constructor_operator))
        (variable)))))

================================================================================
type: mixed infix
================================================================================

type A = A :++ A A ': A (A A a) : '[] ':++ A `A.A` '[]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (name)
        (constructor_operator)
        (infix
          (apply
            (name)
            (name))
          (promoted
            (constructor_operator))
          (infix
            (apply
              (name)
              (parens
                (apply
                  (apply
                    (name)
                    (name))
                  (variable))))
            (constructor_operator)
            (infix
              (promoted
                (empty_list))
              (promoted
                (constructor_operator))
              (infix
                (name)
                (infix_id
                  (qualified
                    (module
                      (module_id))
                    (name)))
                (promoted
                  (empty_list))))))))))

================================================================================
type: multi-apply in infix
================================================================================

type A = A a a a ++ A a a a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (infix
        (apply
          (apply
            (apply
              (name)
              (variable))
            (variable))
          (variable))
        (operator)
        (apply
          (apply
            (apply
              (name)
              (variable))
            (variable))
          (variable))))))

================================================================================
type: symbol
================================================================================

type A = "a"
type A = A (A "a")

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

(haskell
  (declarations
    (type_synomym
      (name)
      (literal
        (string)))
    (type_synomym
      (name)
      (apply
        (name)
        (parens
          (apply
            (name)
            (literal
              (string))))))))

================================================================================
type: prefix notation symbol
================================================================================

type A = (++) a a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (apply
        (apply
          (prefix_id
            (operator))
          (variable))
        (variable)))))

================================================================================
type: nullary context
================================================================================

type A = A => A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (context
        (name)
        (name)))))

================================================================================
type: forall only
================================================================================

type A = ∀ a . A a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (forall
        (quantified_variables
          (variable))
        (apply
          (name)
          (variable))))))

================================================================================
type: forall context
================================================================================

type A = ∀ a a . A => A
type A = forall a a . A a => [A]

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

(haskell
  (declarations
    (type_synomym
      (name)
      (forall
        (quantified_variables
          (variable)
          (variable))
        (context
          (name)
          (name))))
    (type_synomym
      (name)
      (forall
        (quantified_variables
          (variable)
          (variable))
        (context
          (apply
            (name)
            (variable))
          (list
            (name)))))))

================================================================================
type: lhs parens
================================================================================

type (A a a) = A

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

(haskell
  (declarations
    (type_synomym
      (parens
        (name)
        (type_params
          (variable)
          (variable)))
      (name))))

================================================================================
type: role
================================================================================

type role A phantom
type role A.A _ representational nominal _ phantom _
type role (A.>>) nominal nominal

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

(haskell
  (declarations
    (role_annotation
      (name)
      (type_role))
    (role_annotation
      (qualified
        (module
          (module_id))
        (name))
      (type_role)
      (type_role)
      (type_role)
      (type_role)
      (type_role)
      (type_role))
    (role_annotation
      (prefix_id
        (qualified
          (module
            (module_id))
          (operator)))
      (type_role)
      (type_role))))

================================================================================
type: kind signature
================================================================================

type A a :: a -> Type

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

(haskell
  (declarations
    (kind_signature
      (name)
      (type_params
        (variable))
      (function
        (variable)
        (name)))))

================================================================================
type: function with multiplicity modifier
================================================================================

type A = a %1-> a
type A = a %1 -> a
type A = a %One -> a
type A = a %m -> a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (linear_function
        (variable)
        (modifier
          (literal
            (integer)))
        (variable)))
    (type_synomym
      (name)
      (linear_function
        (variable)
        (modifier
          (literal
            (integer)))
        (variable)))
    (type_synomym
      (name)
      (linear_function
        (variable)
        (modifier
          (name))
        (variable)))
    (type_synomym
      (name)
      (linear_function
        (variable)
        (modifier
          (variable))
        (variable)))))

================================================================================
type: special linear arrows
================================================================================

type A = A ->. A
type A = A ⊸ A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (linear_function
        (name)
        (name)))
    (type_synomym
      (name)
      (linear_function
        (name)
        (name)))))

================================================================================
type: unboxed nullary tuple
================================================================================

type A = (# #)
type A = (##)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unboxed_unit))
    (type_synomym
      (name)
      (unboxed_unit))))

================================================================================
type: unboxed unary tuple
================================================================================

type A = (# a #)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unboxed_tuple
        (variable)))))

================================================================================
type: unboxed tuple with newline after opening brace
================================================================================

type A =
  (#
    a #)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unboxed_tuple
        (variable)))))

================================================================================
type: unboxed tuple with newline before closing brace
================================================================================

type A =
  (# a
    #)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unboxed_tuple
        (variable)))))

================================================================================
type: unboxed sum
================================================================================

type A = (# A | A# #)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (unboxed_sum
        (name)
        (name)))))

================================================================================
type: prefix notation unboxed tuple
================================================================================

type A = (# ,,, #) @A @A A# A#

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

(haskell
  (declarations
    (type_synomym
      (name)
      (apply
        (apply
          (apply
            (apply
              (prefix_unboxed_tuple)
              (kind_application
                (name)))
            (kind_application
              (name)))
          (name))
        (name)))))

================================================================================
type: prefix notation unboxed sum
================================================================================

type A = (# | #) @A @A A# A#
type A = (# | | | #) @A @A A# A#

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

(haskell
  (declarations
    (type_synomym
      (name)
      (apply
        (apply
          (apply
            (apply
              (prefix_unboxed_sum)
              (kind_application
                (name)))
            (kind_application
              (name)))
          (name))
        (name)))
    (type_synomym
      (name)
      (apply
        (apply
          (apply
            (apply
              (prefix_unboxed_sum)
              (kind_application
                (name)))
            (kind_application
              (name)))
          (name))
        (name)))))

================================================================================
type: unicode arrows
================================================================================

type A = A ⇒ a → a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (context
        (name)
        (function
          (variable)
          (variable))))))

================================================================================
type: unicode star
================================================================================

type A = ★

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

(haskell
  (declarations
    (type_synomym
      (name)
      (star))))

================================================================================
type: kind application
================================================================================

type A = A @A @A A
type A = A @A A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (apply
        (apply
          (apply
            (name)
            (kind_application
              (name)))
          (kind_application
            (name)))
        (name)))
    (type_synomym
      (name)
      (apply
        (apply
          (name)
          (kind_application
            (name)))
        (name)))))

================================================================================
type: kind signature in nested type
================================================================================

type A = (∀ a . A (a :: A) => a :: A, A)

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

(haskell
  (declarations
    (type_synomym
      (name)
      (tuple
        (signature
          (forall
            (quantified_variables
              (variable))
            (context
              (apply
                (name)
                (parens
                  (signature
                    (variable)
                    (name))))
              (variable)))
          (name))
        (name)))))

================================================================================
type: inferred binder at column 0
================================================================================

type A :: ∀ {
a
} . a

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

(haskell
  (declarations
    (kind_signature
      (name)
      (forall
        (quantified_variables
          (inferred
            (variable)))
        (variable)))))

================================================================================
type: double signature
================================================================================

type A = (A :: A) :: A

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

(haskell
  (declarations
    (type_synomym
      (name)
      (signature
        (parens
          (signature
            (name)
            (name)))
        (name)))))

================================================================================
type: HKT annotation
================================================================================

type A = (a :: (* -> *) -> *) -> a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (function
        (parens
          (signature
            (variable)
            (function
              (parens
                (function
                  (star)
                  (star)))
              (star))))
        (variable)))))

================================================================================
type: splice
================================================================================

type A = a -> $(a ''A) -> a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (function
        (variable)
        (function
          (splice
            (parens
              (apply
                (variable)
                (th_quoted_name
                  (name)))))
          (variable))))))

================================================================================
type: quasiquote
================================================================================

type A = a -> [a|a|] -> a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (function
        (variable)
        (function
          (quasiquote
            (quoter
              (variable))
            (quasiquote_body))
          (variable))))))

================================================================================
type: inferred type variable
================================================================================

type A = ∀ {a} {a :: A} a . a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (forall
        (quantified_variables
          (inferred
            (variable))
          (inferred
            (annotated
              (variable)
              (name)))
          (variable))
        (variable)))))

================================================================================
type: required type arguments
================================================================================

type A = ∀ a (a :: A) {a :: A} -> forall a -> forall a . a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (forall_required
        (quantified_variables
          (variable)
          (parens
            (annotated
              (variable)
              (name)))
          (inferred
            (annotated
              (variable)
              (name))))
        (forall_required
          (quantified_variables
            (variable))
          (forall
            (quantified_variables
              (variable))
            (variable)))))))

================================================================================
type: forall without variables
================================================================================

type A = ∀ . a
type A = ∀ -> a

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

(haskell
  (declarations
    (type_synomym
      (name)
      (forall
        (variable)))
    (type_synomym
      (name)
      (forall_required
        (variable)))))
