<commit_before>
open Type
open Camlp4.PreCast

type context = {
  (* mapping from type parameters to functor arguments *)
  argmap : Type.name Type.NameMap.t;
  (* ordered list of type parameters *)
  params : Type.param list;
  (* type names *)
  tnames : Type.NameSet.t;
  (* For class dependencies, e.g. Pickle. *)
  toplevel : (Type.name * Type.expr) option
}

module type Loc = sig
  val loc : Loc.t (* location of the type definition being derived *)
end

type dependency = {
    d_classname: string;
    d_generate_expr: context -> Type.expr -> Ast.module_expr;
  }

module type ClassDescription = sig
  val classname: name
  val runtimename: name
  val default_module: name option
  val allow_private: bool
  val predefs: (Type.qname * Type.name) list
  val depends:  (Loc.t -> dependency) list
end

module type Class = sig
  val generate: context -> Type.decl list -> Ast.str_item
  val generate_sigs: context -> Type.decl list -> Ast.sig_item
  val generate_expr: context -> Type.expr -> Ast.module_expr
end

class type virtual generator = object

      method rhs: context -> Type.decl -> Ast.module_expr
      method expr: context -> Type.expr -> Ast.module_expr

      method mapply: context -> Ast.module_expr -> Type.expr list -> Ast.module_expr

      method constr: context -> Type.qname * Type.expr list -> Ast.module_expr
      method param: context -> Type.param -> Ast.module_expr

      method wrap: context -> Type.expr -> Ast.str_item list -> Ast.module_expr

      method call_expr: context -> Type.expr -> string -> Ast.expr

      method virtual sum:
	  ?eq:Type.expr -> context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.summand list -> Ast.str_item list
      method virtual tuple: context -> Type.expr list -> Ast.str_item list
      method virtual variant:
	  context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.variant -> Ast.str_item list
      method virtual record:
	  ?eq:Type.expr -> context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.field list -> Ast.str_item list

      method class_: context -> [ `NYI ] -> Ast.str_item list
      method function_: context -> Type.expr * Type.expr -> Ast.str_item list
      method label:
          context ->
	    [ `NonOptional | `Optional ] * Type.name * Type.expr * Type.expr ->
	      Ast.str_item list
      method object_: context -> [ `NYI ] -> Ast.str_item list

    end

module type ClassHelpers = sig

  include Loc
  module Untranslate : Type.Untranslate

  val seq: Ast.expr -> Ast.expr -> Ast.expr
  val seq_list: Ast.expr list -> Ast.expr

  val record_pattern: ?prefix:string -> Type.field list -> Ast.patt
  val record_expr: (string * Ast.expr) list -> Ast.expr
  val record_expression: ?prefix:string -> Type.field list -> Ast.expr

  val expr_list: Ast.expr list -> Ast.expr
  val patt_list: Ast.patt list -> Ast.patt

  val tuple_expr: Ast.expr list -> Ast.expr
  val tuple: ?param:string -> int -> string list * Ast.patt * Ast.expr

  val cast_pattern:
      context -> ?param:string -> Type.expr -> Ast.patt * Ast.expr * Ast.expr

  (* Should not be exported once "call_expr" is defined... *)
  val atype_expr: context -> Type.expr -> Ast.ctyp
  val atype: context -> Type.decl -> Ast.ctyp
  val apply_functor: Ast.module_expr -> Ast.module_expr list -> Ast.module_expr
  val modname_from_qname:  qname:string list -> classname:string -> Ast.ident
  val substitute: Type.name Type.NameMap.t -> Type.expr -> Type.expr

  (* For Pickle only *)
  val instantiate_modargs_repr: context -> Type.repr -> Type.repr

  class virtual make_module_expr : generator
  val make_module_sig: context -> Type.decl -> Ast.module_type
  val make_module_type: context -> Type.decl -> Ast.module_type

  val default_generate:
      make_module_expr:(context -> Type.decl -> Ast.module_expr) ->
      make_module_type:(context -> Type.decl -> Ast.module_type) ->
	context -> Type.decl list -> Ast.str_item
  val default_generate_sigs:
      make_module_sig:(context -> Type.decl -> Ast.module_type) ->
	context -> Type.decl list -> Ast.sig_item

end<commit_msg>syntax: Defs: suppress unused functions.<commit_after>
open Type
open Camlp4.PreCast

type context = {
  (* mapping from type parameters to functor arguments *)
  argmap : Type.name Type.NameMap.t;
  (* ordered list of type parameters *)
  params : Type.param list;
  (* type names *)
  tnames : Type.NameSet.t;
  (* For class dependencies, e.g. Pickle. *)
  toplevel : (Type.name * Type.expr) option
}

module type Loc = sig
  val loc : Loc.t (* location of the type definition being derived *)
end

type dependency = {
    d_classname: string;
    d_generate_expr: context -> Type.expr -> Ast.module_expr;
  }

module type ClassDescription = sig
  val classname: name
  val runtimename: name
  val default_module: name option
  val allow_private: bool
  val predefs: (Type.qname * Type.name) list
  val depends:  (Loc.t -> dependency) list
end

module type Class = sig
  val generate: context -> Type.decl list -> Ast.str_item
  val generate_sigs: context -> Type.decl list -> Ast.sig_item
  val generate_expr: context -> Type.expr -> Ast.module_expr
end

class type virtual generator = object

      method rhs: context -> Type.decl -> Ast.module_expr
      method expr: context -> Type.expr -> Ast.module_expr

      method mapply: context -> Ast.module_expr -> Type.expr list -> Ast.module_expr

      method constr: context -> Type.qname * Type.expr list -> Ast.module_expr
      method param: context -> Type.param -> Ast.module_expr

      method wrap: context -> Type.expr -> Ast.str_item list -> Ast.module_expr

      method call_expr: context -> Type.expr -> string -> Ast.expr

      method virtual sum:
	  ?eq:Type.expr -> context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.summand list -> Ast.str_item list
      method virtual tuple: context -> Type.expr list -> Ast.str_item list
      method virtual variant:
	  context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.variant -> Ast.str_item list
      method virtual record:
	  ?eq:Type.expr -> context ->
	    Type.name -> Type.param list -> Type.constraint_ list ->
	      Type.field list -> Ast.str_item list

      method class_: context -> [ `NYI ] -> Ast.str_item list
      method function_: context -> Type.expr * Type.expr -> Ast.str_item list
      method label:
          context ->
	    [ `NonOptional | `Optional ] * Type.name * Type.expr * Type.expr ->
	      Ast.str_item list
      method object_: context -> [ `NYI ] -> Ast.str_item list

    end

module type ClassHelpers = sig

  include Loc
  module Untranslate : Type.Untranslate

  val seq: Ast.expr -> Ast.expr -> Ast.expr
  val seq_list: Ast.expr list -> Ast.expr

  val record_pattern: ?prefix:string -> Type.field list -> Ast.patt
  val record_expr: (string * Ast.expr) list -> Ast.expr
  val record_expression: ?prefix:string -> Type.field list -> Ast.expr

  val expr_list: Ast.expr list -> Ast.expr
  val patt_list: Ast.patt list -> Ast.patt

  val tuple_expr: Ast.expr list -> Ast.expr
  val tuple: ?param:string -> int -> string list * Ast.patt * Ast.expr

  val cast_pattern:
      context -> ?param:string -> Type.expr -> Ast.patt * Ast.expr * Ast.expr

  (* For Functor only *)
  val modname_from_qname:  qname:string list -> classname:string -> Ast.ident
  val substitute: Type.name Type.NameMap.t -> Type.expr -> Type.expr

  (* For Pickle only *)
  val instantiate_modargs_repr: context -> Type.repr -> Type.repr

  class virtual make_module_expr : generator
  val make_module_sig: context -> Type.decl -> Ast.module_type
  val make_module_type: context -> Type.decl -> Ast.module_type

  val default_generate:
      make_module_expr:(context -> Type.decl -> Ast.module_expr) ->
      make_module_type:(context -> Type.decl -> Ast.module_type) ->
	context -> Type.decl list -> Ast.str_item
  val default_generate_sigs:
      make_module_sig:(context -> Type.decl -> Ast.module_type) ->
	context -> Type.decl list -> Ast.sig_item

end
{'fraction_non_alphanumeric': 0.11518971696947225, 'fraction_numerical': 0.00024718823384006923, 'mean_word_length': 2.8736237434179035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 193, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3896680', 'n_tokens_mistral': 2523, 'n_tokens_neox': 2448, 'n_words': 750}