========================
Type Class, with Methods
========================

module corpus_test_typeclass is

  class Any (T) is
    def is_structure(v -> T) -> boolean
    def new -> T
    def is_entity(v -> T) -> boolean is
      @skos:prefLabel = "is an entity"
    end
    def has_member(v -> T) -> boolean := is_product_type(v)
  end

end

---

(module
  (identifier)
  (module_body
    (type_class_def
      (identifier)
      (type_parameter
        (identifier))
      (type_class_body
        (keyword_function_def
          (function_def
            (function_signature
              (identifier)
              (function_parameter
                (identifier)
                (function_type_reference
                  (identifier_reference
                    (identifier))))
              (function_type_reference
                (builtin_types)))))
        (keyword_function_def
          (function_def
            (function_signature
              (identifier)
              (function_type_reference
                (identifier_reference
                  (identifier))))))
        (keyword_function_def
          (function_def
            (function_signature
              (identifier)
              (function_parameter
                (identifier)
                (function_type_reference
                  (identifier_reference
                    (identifier))))
              (function_type_reference
                (builtin_types)))
            (annotation_only_body
              (annotation
                (annotation_property
                  (identifier_reference
                    (qualified_identifier
                      (identifier)
                      (identifier)))
                  (value
                    (simple_value
                      (string
                        (quoted_string)))))))))
        (keyword_function_def
          (function_def
            (function_signature
              (identifier)
              (function_parameter
                (identifier)
                (function_type_reference
                  (identifier_reference
                    (identifier))))
              (function_type_reference
                (builtin_types)))
            (function_body
              (term
                (functional_term
                  (term
                    (identifier_reference
                      (identifier)))
                  (term
                    (identifier_reference
                      (identifier))))))))))))
