=========================================
Type Synonym Declarations
=========================================

type Foo = Bar
type List = []
type Foo a = Bar a
type Rec a = [Circ a]
type V = ()
type X = (,)
type Y = (,,)
type Z = (->)

---

(module
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body (type_pattern (type_constructor_identifier))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body (type_pattern (list_constructor))))
  (type_synonym_declaration
    (type_constructor_identifier) (type_variable_identifier)
    (type_synonym_body (type_pattern (type_constructor_identifier) (type_variable_identifier))))
  (type_synonym_declaration
    (type_constructor_identifier) (type_variable_identifier)
    (type_synonym_body
      (type_pattern (list_type (type (type_constructor_identifier) (type_variable_identifier))))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (type_pattern (unit_constructor))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (type_pattern (tupling_constructor))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (type_pattern (tupling_constructor))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (type_pattern (function_constructor)))))

=========================================
Type Synonym Declarations With Promoted Constructors
=========================================

type Nat = Zero ': Succ Zero ': Succ (Succ Zero) ': '[]
type Foo bar baz wix = '[ W, A (B c) ]
type Foo Bar = "higher-kinded"
type Foo (Bar m a) = BarF m a
type Foo '[] a = a

---

(module
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (type_pattern
        (infix_operator_pattern
          (type (type_constructor_identifier))
          (type_operator)
          (type
            (infix_operator_pattern
              (type (type_constructor_identifier) (type_constructor_identifier))
              (type_operator)
              (type
                (infix_operator_pattern
                  (type (type_constructor_identifier) (parenthesized_type_pattern (type_constructor_identifier) (type_constructor_identifier)))
                  (type_operator)
                  (type (quoted_name (list_constructor)))))))))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (type_synonym_body
      (type_pattern
        (quoted_name
          (list_type
            (type (type_constructor_identifier))
            (type
              (type_constructor_identifier)
              (parenthesized_type_pattern
                (type_constructor_identifier)
                (type_variable_identifier))))))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_constructor_identifier)
    (type_synonym_body
      (string)))
  (type_synonym_declaration
    (type_constructor_identifier)
    (parenthesized_type_pattern
      (type_constructor_identifier)
      (type_variable_identifier)
      (type_variable_identifier))
    (type_synonym_body
      (type_pattern
        (type_constructor_identifier)
        (type_variable_identifier)
        (type_variable_identifier))))
  (type_synonym_declaration
    (type_constructor_identifier)
    (quoted_name
      (list_constructor))
    (type_variable_identifier)
    (type_synonym_body
      (variable_identifier))))

=========================================
Type Synonym Declarations With Context
=========================================

type Foo = HasCallStack => Bar []

---

(module
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_synonym_body
      (context (context_pattern (type_constructor_identifier)))
      (type_pattern
        (type_constructor_identifier)
        (list_constructor)))))

=========================================
Type Synonym Declarations With Scoped Type Variables
=========================================

type Foo a b = forall a b. FooF a b

---

(module
  (type_synonym_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (type_synonym_body
      (scoped_type_variables (type_variable_identifier) (type_variable_identifier) (dot))
      (type_pattern
        (type_constructor_identifier)
        (type_variable_identifier)
        (type_variable_identifier)))))

=========================================
Type Synonym Declarations With Parenthesized Type Pattern
=========================================

type (Member t r) = KnownNat (ElemIndex t r)

---

(module
  (type_synonym_declaration
    (parenthesized_type_pattern
      (type_constructor_identifier)
      (type_variable_identifier)
      (type_variable_identifier))
    (type_synonym_body
      (type_pattern
        (type_constructor_identifier)
        (parenthesized_type_pattern
          (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier))))))

=========================================
New Type Declarations
=========================================

newtype N = N Int
newtype Show a => N = N a
newtype Age = Age { unAge :: Maybe Int }
newtype Bar a (b :: [* -> *]) c = Foo (a b c)

---

(module
  (newtype_declaration
    (type_constructor_identifier)
    (new_constructor
      (constructor_identifier)
      (type_constructor_identifier)))
  (newtype_declaration
    (context
      (context_pattern
        (class (type_class_identifier) (type_variable_identifier))))
    (type_constructor_identifier)
    (new_constructor
      (constructor_identifier)
      (type_variable_identifier)))
  (newtype_declaration
    (type_constructor_identifier)
    (new_constructor
      (constructor_identifier)
      (fields
        (field
          (variable_identifier)
          (annotation)
          (type_constructor_identifier)
          (type_constructor_identifier)))))
  (newtype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (annotated_type_variable
      (type_variable_identifier)
      (annotation)
      (kind_list_type
        (kind_function_type
          (kind (star))
          (kind (star)))))
    (type_variable_identifier)
    (new_constructor
      (constructor_identifier)
      (parenthesized_type_pattern
        (type_variable_identifier)
        (type_variable_identifier)
        (type_variable_identifier)))))

=========================================
New Type Declarations With Deriving
=========================================

newtype N = N Int deriving Show
newtype N = N a deriving (Eq, Ord, Enum, Bounded, Show, Read)

---

(module
  (newtype_declaration
    (type_constructor_identifier)
    (new_constructor
      (constructor_identifier)
      (type_constructor_identifier))
    (deriving (type_class_identifier)))
  (newtype_declaration
    (type_constructor_identifier)
    (new_constructor
      (constructor_identifier)
      (type_variable_identifier))
    (deriving
      (type_class_identifier)
      (type_class_identifier)
      (type_class_identifier)
      (type_class_identifier)
      (type_class_identifier)
      (type_class_identifier))))

=========================================
Algebraic Datatype Declarations With Variables
=========================================

data N
data N a = N a
data N a = N !a
data N a b = N !a b

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor (constructor_identifier) (type_variable_identifier))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor (constructor_identifier) (strict_type (type_variable_identifier)))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor (constructor_identifier) (strict_type (type_variable_identifier)) (type_variable_identifier)))))

=========================================
Algebraic Datatype Declarations With Fields
=========================================

data N = N { a :: Int }
data N = N { a, b :: Int }
data N = N { a :: !Int, b :: Int }
data N = N { a, b :: {-#  UNPACK #-} !Int, c :: String }

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (record_data_constructor
        (constructor_identifier)
        (fields (field (variable_identifier) (annotation) (type_constructor_identifier))))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (record_data_constructor
        (constructor_identifier)
        (fields (field (variable_identifier) (variable_identifier) (annotation) (type_constructor_identifier))))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (record_data_constructor
        (constructor_identifier)
        (fields
          (field (variable_identifier) (annotation) (strict_type (type_constructor_identifier)))
          (field (variable_identifier) (annotation) (type_constructor_identifier))))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (record_data_constructor
        (constructor_identifier)
        (fields
          (field
            (variable_identifier)
            (variable_identifier)
            (annotation)
            (pragma)
            (strict_type (type_constructor_identifier)))
          (field
            (variable_identifier)
            (annotation)
            (type_constructor_identifier)))))))

=========================================
Algebraic Datatype Declarations With Multiple Constructors
=========================================

data N = N | O
data N = N { a :: Int } | O { b :: String }

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (data_constructor
        (constructor_identifier))
      (data_constructor
        (constructor_identifier))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (record_data_constructor
        (constructor_identifier)
        (fields
          (field (variable_identifier) (annotation) (type_constructor_identifier))))
      (record_data_constructor
        (constructor_identifier)
        (fields
          (field (variable_identifier) (annotation) (type_constructor_identifier)))))))

=========================================
Algebraic Datatype Declarations With Deriving
=========================================

data N = N deriving Show
data N = N deriving (Eq, Ord, Enum, Bounded, Show, Read)

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors (data_constructor (constructor_identifier)))
    (deriving (type_class_identifier)))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors (data_constructor (constructor_identifier)))
    (deriving (type_class_identifier) (type_class_identifier) (type_class_identifier) (type_class_identifier) (type_class_identifier) (type_class_identifier))))

=========================================
Algebraic Datatype Declarations With Context
=========================================

data Show a => N a = N a
data (Eq a, Show a, Eq b) => N a b = N a b
data (Eq (f a), Functor f) => N f a = N f a

---

(module
  (algebraic_datatype_declaration
    (context
      (context_pattern
        (class (type_class_identifier) (type_variable_identifier))))
    (type_constructor_identifier) (type_variable_identifier)
    (constructors
      (data_constructor (constructor_identifier) (type_variable_identifier))))
  (algebraic_datatype_declaration
    (context
      (context_pattern (class (type_class_identifier) (type_variable_identifier)))
      (context_pattern (class (type_class_identifier) (type_variable_identifier)))
      (context_pattern (class (type_class_identifier) (type_variable_identifier))))
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor
        (constructor_identifier) (type_variable_identifier) (type_variable_identifier))))
  (algebraic_datatype_declaration
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (parenthesized_type_pattern
            (type_variable_identifier)
            (type_variable_identifier))))
      (context_pattern (class (type_class_identifier) (type_variable_identifier))))
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor
        (constructor_identifier) (type_variable_identifier) (type_variable_identifier)))))

=========================================
Algebraic Datatype Declarations With Primitive Constructors
=========================================

data Foo = Foo !Double#

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (data_constructor
        (constructor_identifier)
        (strict_type (primitive_constructor_identifier))))))

=========================================
Algebraic Datatype Declarations With Scoped Type Variables
=========================================

data SomeNumber = forall a . SomeNumber (Number a)

data Eff effects b = Val b
                   | forall a. E (Union effects a) (Queue effects a b)

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (constructors
      (data_constructor
        (scoped_type_variables (type_variable_identifier) (dot))
        (constructor_identifier)
        (parenthesized_type_pattern
          (type_constructor_identifier)
          (type_variable_identifier)))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor
        (constructor_identifier)
        (type_variable_identifier))
      (data_constructor
        (scoped_type_variables
          (type_variable_identifier) (dot))
        (constructor_identifier)
        (parenthesized_type_pattern
          (type_constructor_identifier)
          (type_variable_identifier)
          (type_variable_identifier))
        (parenthesized_type_pattern
          (type_constructor_identifier)
          (type_variable_identifier)
          (type_variable_identifier)
          (type_variable_identifier))))))

=========================================
Algebraic Datatype Declarations With Constrained Constructors
=========================================

data Foo bar = HasCallStack => Foo bar
data Baz foo = Show foo => Baz foo

---

(module
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor
      (context
        (context_pattern (type_constructor_identifier)))
          (constructor_identifier)
          (type_variable_identifier))))
  (algebraic_datatype_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (constructors
      (data_constructor
        (context
          (context_pattern
            (class (type_class_identifier) (type_variable_identifier))))
        (constructor_identifier)
        (type_variable_identifier)))))

=========================================
GADT Declarations
=========================================

data Foo a b c where
  Baz :: a -> b -> c -> Foo a b c
  Bar :: a -> b -> c -> Foo a b c

---

(module
  (gadt_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (where
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type (type_variable_identifier))
          (function_type
            (type (type_variable_identifier))
            (function_type
              (type (type_variable_identifier))
              (type (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier) (type_variable_identifier))))))
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type (type_variable_identifier))
          (function_type
            (type (type_variable_identifier))
            (function_type
              (type (type_variable_identifier))
              (type (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier) (type_variable_identifier)))))))))

=========================================
GADT Declarations With Fields
=========================================

data Foo f a where
  Bar :: { jolo :: Maybe String, runJolo :: f a } -> Foo f a

---

(module
  (gadt_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (type_variable_identifier)
    (where
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type
            (fields
              (field (variable_identifier) (annotation) (type_constructor_identifier) (type_constructor_identifier))
              (field (variable_identifier) (annotation) (type_variable_identifier) (type_variable_identifier))))
          (type (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier)))))))

=========================================
GADT Declarations With Kind Signatures
=========================================

data Foo :: [*] -> * where

---

(module
  (gadt_declaration
    (type_constructor_identifier)
    (kind_signature
      (annotation)
      (kind_function_type
        (kind (kind_list_type (star)))
        (kind (star))))
    (where)))

=========================================
GADT Declarations With Strict Types
=========================================

data Number a where
  Integer :: !Prelude.Integer  -> Number Prelude.Integer
  Ratio   :: !Prelude.Rational -> Number Prelude.Rational
  Decimal :: !Scientific       -> Number Scientific

---

(module
  (gadt_declaration
    (type_constructor_identifier)
    (type_variable_identifier)
    (where
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type (strict_type (qualified_type_constructor_identifier (module_identifier) (type_constructor_identifier))))
          (type (type_constructor_identifier) (qualified_type_constructor_identifier (module_identifier) (type_constructor_identifier)))))
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type (strict_type (qualified_type_constructor_identifier (module_identifier) (type_constructor_identifier))))
          (type (type_constructor_identifier) (qualified_type_constructor_identifier (module_identifier) (type_constructor_identifier)))))
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (function_type
          (type (strict_type (type_constructor_identifier)))
          (type (type_constructor_identifier) (type_constructor_identifier)))))))

=========================================
GADT Declarations With Pragms
=========================================

data Union (r :: [ * -> * ]) (v :: *) where
  Union :: {-# UNPACK #-} !Int -> t v -> Union r v

---

(module
  (gadt_declaration
    (type_constructor_identifier)
    (annotated_type_variable
      (type_variable_identifier)
      (annotation)
      (kind_list_type
        (kind_function_type (kind (star)) (kind (star)))))
    (annotated_type_variable
      (type_variable_identifier)
      (annotation)
      (star))
    (where
      (gadt_constructor
        (type_constructor_identifier)
        (annotation)
        (pragma)
        (function_type
          (type (strict_type (type_constructor_identifier)))
          (function_type
            (type
              (type_variable_identifier)
              (type_variable_identifier))
            (type
              (type_constructor_identifier)
              (type_variable_identifier)
              (type_variable_identifier))))))))

========================================
Default declarations
=========================================

default ()
default (Integer, Double)

---

(module
  (default_declaration)
  (default_declaration (type_constructor_identifier) (type_constructor_identifier)))


=========================================
Type Signatures With Variables
=========================================

f :: a -> a -> a

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type (type_variable_identifier))
      (function_type
        (type (type_variable_identifier))
        (type (type_variable_identifier))))))


=========================================
Type Signatures With Constructors
=========================================

f :: Ex -> Ex
f :: [Int] -> Int
f :: (Int, Int) -> Maybe Int
f :: a -> B c (D (E g ': h)) -> I [J k] (L m (N (O p ': q)))

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type (type_constructor_identifier))
      (type (type_constructor_identifier))))
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type (list_type (type (type_constructor_identifier))))
      (type (type_constructor_identifier))))
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type (tuple_type (type (type_constructor_identifier)) (type (type_constructor_identifier))))
      (type (type_constructor_identifier) (type_constructor_identifier))))
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type (type_variable_identifier))
      (function_type
        (type
          (type_constructor_identifier)
          (type_variable_identifier)
          (parenthesized_type_pattern
            (type_constructor_identifier)
            (parenthesized_type_pattern
              (infix_operator_pattern
                (type
                  (type_constructor_identifier)
                  (type_variable_identifier))
                (type_operator)
                (type (type_variable_identifier))))))
        (type
          (type_constructor_identifier)
          (list_type
            (type
              (type_constructor_identifier)
              (type_variable_identifier)))
          (parenthesized_type_pattern
            (type_constructor_identifier)
            (type_variable_identifier)
            (parenthesized_type_pattern
              (type_constructor_identifier)
              (parenthesized_type_pattern
              (infix_operator_pattern
                (type
                  (type_constructor_identifier)
                  (type_variable_identifier))
                (type_operator)
                (type (type_variable_identifier)))))))))))

=========================================
Type Signatures With Scoped Type Variables
=========================================

f :: forall a. [a] -> [a]
f :: forall a b. (a, b) -> [a]
apply :: proxy c -> (forall g . c g => g a -> b) -> Union fs a -> b

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (scoped_type_variables (type_variable_identifier) (dot))
    (function_type
      (type (list_type (type (type_variable_identifier))))
      (type (list_type (type (type_variable_identifier))))))
  (type_signature
    (variable_identifier)
    (annotation)
    (scoped_type_variables (type_variable_identifier) (type_variable_identifier) (dot))
    (function_type
      (type
        (tuple_type (type (type_variable_identifier)) (type (type_variable_identifier))))
      (type
        (list_type (type (type_variable_identifier))))))
  (type_signature
    (variable_identifier)
    (annotation)
      (function_type
        (type (type_variable_identifier) (type_variable_identifier))
        (function_type
          (type
            (parenthesized_type_pattern
              (scoped_type_variables (type_variable_identifier) (dot))
              (context
                (context_pattern
                  (type_variable_identifier)
                  (type_variable_identifier)))
              (function_type
                (type (type_variable_identifier) (type_variable_identifier))
                (type (type_variable_identifier)))))
          (function_type
            (type (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier))
            (type (type_variable_identifier)))))))

=========================================
Type Signatures With Equality Constraints
=========================================

f :: a ~ Int => a
f :: (a ~ Int) => a
sumCollects :: forall c1 c2. (B c1, B c2, E c1 ~ E c2) => c1 -> c2 -> c2

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (equality_constraint
          (equality_lhs (type_variable_identifier))
          (equality_rhs (type_constructor_identifier)))))
    (type_variable_identifier))

  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (equality_constraint
          (equality_lhs (type_variable_identifier))
          (equality_rhs (type_constructor_identifier)))))
    (type_variable_identifier))

  (type_signature
    (variable_identifier)
    (annotation)
    (scoped_type_variables
      (type_variable_identifier)
      (type_variable_identifier)
      (dot))
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier)))
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier)))
      (context_pattern
        (equality_constraint
          (equality_lhs (class (type_class_identifier) (type_variable_identifier)))
          (equality_rhs (class (type_class_identifier) (type_variable_identifier))))))
    (function_type
      (type
        (type_variable_identifier))
        (function_type
          (type (type_variable_identifier))
          (type (type_variable_identifier))))))

=========================================
Type Signatures With Non-traditional Class Contexts
=========================================

foo :: Bar zoo Baz => Bix

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier)
          (type_constructor_identifier))))
    (type_constructor_identifier)))

=========================================
Type Signatures With Multiple Contexts
=========================================

foo :: (Bar m) => Baz [Fiz Fuzz, Wiz, Wax, Woz] bar => a -> Baz m

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context (context_pattern (class (type_class_identifier) (type_variable_identifier))))
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (list_type
            (type
              (type_constructor_identifier)
              (type_constructor_identifier))
            (type (type_constructor_identifier))
            (type (type_constructor_identifier))
            (type (type_constructor_identifier)))
          (type_variable_identifier))))
    (function_type
      (type (type_variable_identifier))
      (type (type_constructor_identifier) (type_variable_identifier)))))

=========================================
Type Signatures With Contexts Including Promoted Constructors
=========================================

bar :: (Baz '[Foo Wix a] biz, Waz woo) => Out a -> [Foo] -> Baz biz Waz

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (quoted_name
            (list_type
              (type
                (type_constructor_identifier)
                (type_constructor_identifier)
                (type_variable_identifier))))
            (type_variable_identifier)))
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier))))
    (function_type
      (type (type_constructor_identifier) (type_variable_identifier))
      (function_type
        (type (list_type (type (type_constructor_identifier))))
        (type (type_constructor_identifier) (type_variable_identifier) (type_constructor_identifier))))))

=========================================
Type Signatures With Single Constructor Context
=========================================

foo :: HasCallStack => a -> a

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern (type_constructor_identifier)))
    (function_type
      (type (type_variable_identifier))
      (type (type_variable_identifier)))))

=========================================
Type Signatures With Single Constructor Context Function Type
=========================================

withStateCallStack :: Maybe (String, SrcLoc) -> State a b -> (HasCallStack => c) -> c

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (function_type
      (type
        (type_constructor_identifier)
        (tuple_type (type (type_constructor_identifier)) (type (type_constructor_identifier))))
      (function_type
        (type (type_constructor_identifier) (type_variable_identifier) (type_variable_identifier))
        (function_type
          (type
            (parenthesized_type_pattern
              (context
                (context_pattern
                  (type_constructor_identifier)))
              (type_variable_identifier)))
          (type (type_variable_identifier)))))))

=========================================
Type Signatures With Parenthesized Pattern Context
=========================================

foo :: (f :< Bar) => Bar -> f
yield :: ((Yield a b) :< e) => a

---

(module
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (type_variable_identifier)
        (constructor_operator (constructor_symbol))
        (type_constructor_identifier)))
    (function_type
      (type (type_constructor_identifier))
      (type (type_variable_identifier))))
  (type_signature
    (variable_identifier)
    (annotation)
    (context
      (context_pattern
        (class
          (type_class_identifier) (type_variable_identifier) (type_variable_identifier))
        (constructor_operator (constructor_symbol))
        (type_variable_identifier)))
    (type_variable_identifier)))

=========================================
Standalone Deriving
=========================================

deriving instance Eq a => Eq (Foo a)
deriving instance Baz a (m a b c) => Baz a (Bar m a b c)
deriving instance Bar Baz foo => BazFail (BarEval foo bix waz)
deriving instance Bar (Foo (Baz waz)) bix => BazHeap bix (BarEval bix wax)

---

(module
  (standalone_deriving_declaration
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier))))
    (type_class_identifier)
    (instance
      (parenthesized_type_pattern
        (type_constructor_identifier)
        (type_variable_identifier))))
  (standalone_deriving_declaration
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (type_variable_identifier)
          (parenthesized_type_pattern
            (type_variable_identifier)
            (type_variable_identifier)
            (type_variable_identifier)
            (type_variable_identifier)))))
    (type_class_identifier)
    (instance
      (type_variable_identifier)
      (parenthesized_type_pattern
        (type_constructor_identifier)
        (type_variable_identifier)
        (type_variable_identifier)
        (type_variable_identifier)
        (type_variable_identifier))))
  (standalone_deriving_declaration
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (type_constructor_identifier)
          (type_variable_identifier))))
    (type_class_identifier)
    (instance
      (parenthesized_type_pattern
        (type_constructor_identifier)
        (type_variable_identifier)
        (type_variable_identifier)
        (type_variable_identifier))))
  (standalone_deriving_declaration
    (context
      (context_pattern
        (class
          (type_class_identifier)
          (parenthesized_type_pattern
            (type_constructor_identifier)
            (parenthesized_type_pattern
              (type_constructor_identifier)
              (type_variable_identifier)))
            (type_variable_identifier))))
    (type_class_identifier)
    (instance
      (type_variable_identifier)
      (parenthesized_type_pattern
        (type_constructor_identifier)
        (type_variable_identifier)
        (type_variable_identifier)))))
