text stringlengths 12 786k |
|---|
module Lift3 ( X : sig type ( ' a1 , ' a2 , ' a3 ) t end ) = struct let lift ( type a1 b1 a2 b2 a3 b3 ) ( T : ( a1 , b1 ) t ) ( T : ( a2 , b2 ) t ) ( T : ( a3 , b3 ) t ) : ( ( a1 , a2 , a3 ) X . t , ( b1 , b2 , b3 ) X . t ) t = T ; ;... |
let detuple2 ( type a1 a2 b1 b2 ) ( T : ( a1 * a2 , b1 * b2 ) t ) : ( a1 , b1 ) t * ( a2 , b2 ) t = T , T ; ; |
let tuple2 ( type a1 a2 b1 b2 ) ( T : ( a1 , b1 ) t ) ( T : ( a2 , b2 ) t ) : ( a1 * a2 , b1 * b2 ) t = T |
module type Injective = sig type ' a t val strip : ( ' a t , ' b t ) equal -> ( ' a , ' b ) equal end |
module type Injective2 = sig type ( ' a1 , ' a2 ) t val strip : ( ( ' a1 , ' a2 ) t , ( ' b1 , ' b2 ) t ) equal -> ( ' a1 , ' b1 ) equal * ( ' a2 , ' b2 ) equal end |
module Composition_preserves_injectivity ( M1 : Injective ) ( M2 : Injective ) = struct type ' a t = ' a M1 . t M2 . t let strip e = M1 . strip ( M2 . strip e ) end |
module Obj = struct module Extension_constructor = struct [ @@@ ocaml . warning " - 3 " ] let id = Caml . Obj . extension_id let of_val = Caml . Obj . extension_constructor end end |
module Id = struct module Uid = Int module Witness = struct module Key = struct type _ t = . . type type_witness_int = [ ` type_witness of int ] [ @@ deriving_inline sexp_of ] let sexp_of_type_witness_int = ( fun ( ` type_witness v__005_ ) -> Sexplib0 . Sexp . List [ Sexplib0 . S... |
[ %% expect { | ^ bool because it is in the condition of an if - statement } ] ; ; | [ %% expect { | ^ bool because it is in the condition of an if - statement } ] ; ; | [ %% expect { | ^ int } ] ; ; | [ %% expect { | ^ bool because it is in the condition of an i... |
let ordered_list_with x y = if x <= y then [ x ; y ] else if x > y then [ y ; x ] [ %% expect { | ^^^^ because it is in the result of a conditional with no else branch The constructor :: does not belong to type unit } ] ; ; | ( function | y when y + 1 -> ( ) | _ -> ( ) )... |
module Helper ( A : Variant_and_record_intf . S ) ( B : Variant_and_record_intf . S ) = struct type map = { map : ' a . ' a A . t -> ' a B . t } let map_variant ( type variant ) { map } ( variant : variant A . Variant . t ) = let map_create = function | A . Tag . ... |
module type Named = sig type ' a computation module Context : sig type t val create : unit -> t end type ' a t val init : Context . t -> ' a Typename . t -> ' a t val get_wip_computation : ' a t -> ' a computation val set_final_computation : ' a t -> ' a computation -> ' a computation ... |
module type Computation = sig type ' a t include Variant_and_record_intf . S with type ' a t := ' a t val int : int t val int32 : int32 t val int64 : int64 t val nativeint : nativeint t val char : char t val float : float t val string : string t val bytes : bytes t val bool : bool t val unit : unit ... |
module Make_named_for_closure ( X : sig type ' a input type ' a output type ' a t = ' a input -> ' a output end ) = struct module Context = struct type t = unit let create = ignore end type ' a t = { runtime_dereference : ' a X . t ; runtime_reference : ' a X . t ref ; compiletim... |
module Ident = struct type t = { name : string ; implements : Typename . Uid . t -> bool } exception Broken_dependency of string let check_dependencies name required = match required with | [ ] -> fun _ -> ( ) | _ -> fun uid -> List . iter ( fun { name = name ' ; implements } ... |
module type Extending = sig type ' a t type ' a computation = ' a t val ident : Ident . t exception Not_implemented of string * string module type S = sig type t include Typerepable . S with type t := t val compute : t computation end module type S1 = sig type ' a t include Typerepable . S1 with t... |
module type S_implementation = sig include Extending val raise_not_implemented : string -> ' a type implementation = { generic : ' a . ' a Typerep . t -> ' a computation } val _using_extended_implementation : implementation -> ' a Typerep . Named . t -> ' a Typerep . t lazy_t option ... |
module type S = sig include Extending val of_typerep : ' a Typerep . t -> [ ` generic of ' a computation ] module Computation : Computation with type ' a t = ' a t end |
module Make_S_implementation ( X : sig type ' a t val name : string val required : Ident . t list end ) : S_implementation with type ' a t = ' a X . t = struct type ' a t = ' a X . t type ' a computation = ' a t include Type_generic_intf . M ( struct type ' a t = ' a computation... |
module _ = Hashtbl . Make ( Typename . Key ) |
module Make ( X : sig type ' a t val name : string val required : Ident . t list include Computation with type ' a t := ' a t end ) = struct module Computation = X include Make_S_implementation ( X ) module Memo = Typename . Table ( struct type ' a t = ' a X . Named . t end ) modul... |
module M ( X : sig type ' a t end ) = struct module type S = sig type t include Typerepable . S with type t := t val compute : t X . t end module type S1 = sig type ' a t include Typerepable . S1 with type ' a t := ' a t val compute : ' a X . t -> ' a t X . t end module type S2 = sig... |
module type S = sig type ' a t include module type of M ( struct type ' a computation = ' a t type ' a t = ' a computation end ) end |
module Make ( D : Debugger . S ) ( Cmt_cache : Cmt_cache_intf . S ) = struct let type_and_env_from_dwarf_type0 ~ dwarf_type ~ cmt_cache = let cmt_file_and_ident_name = match Dwarf_name_laundry . split_base_type_die_name dwarf_type with | None -> None | Some { compilation_unit ; ident_name ; ... |
let helpers_error msg = raise ( Type_helpers_error msg ) |
let michelson_type_to_ex_ty ( typ : Alpha_context . Script . expr ) ( ctxt : Alpha_context . t ) = Script_ir_translator . parse_ty ctxt ~ legacy : false ~ allow_lazy_storage : false ~ allow_operation : false ~ allow_contract : false ~ allow_ticket : false ( Micheline . root typ ) |> ... |
let rec michelson_type_list_to_ex_stack_ty ( stack_ty : Alpha_context . Script . expr list ) ctxt = let open Script_ir_translator in let open Script_typed_ir in match stack_ty with | [ ] -> Ex_stack_ty Bot_t | hd :: tl -> ( let ex_ty = michelson_type_to_ex_ty hd ctxt in match ex_ty with | Ex_ty t... |
let base_type_to_michelson_type ( typ : Type . Base . t ) = let typ = Mikhailsky . map_var ( fun _ -> Mikhailsky . unit_ty ) typ in Mikhailsky . to_michelson typ |
let rec stack_type_to_michelson_type_list ( typ : Type . Stack . t ) = let node = typ . node in match node with | Type . Stack . Stack_var_t _ -> helpers_error " stack_type_to_michelson_type_list : bug found " | Type . Stack . Empty_t -> [ ] | Type . Stack . Item_t ( ty , tl ... |
let base_type_to_ex_ty ty = michelson_type_to_ex_ty ( base_type_to_michelson_type ty ) |
module Key = struct type t = int [ @@ deriving compare , sexp_of ] let hash x = x end |
module Allowed_ints = struct type t = | None | All | Hash_set of Hash_set . M ( Key ) . t | From_zero_to of int let _invariant = function | None | All | Hash_set _ -> ( ) | From_zero_to n -> assert ( n >= 0 ) ; ; let int_is_value t i = match t with | None -> false | All -> true... |
module Immediacy = struct type t = | Always | Sometimes | Never [ @@ deriving compare ] let equal = [ % compare . equal : t ] let to_string = function | Always -> " Always " | Sometimes -> " Sometimes " | Never -> " Never " ; ; end |
module T : sig type ' a t val create : ' a Typename . t -> Immediacy . t -> Allowed_ints . t -> ' a t val create_with_name : string -> Immediacy . t -> Allowed_ints . t -> _ t val immediacy : _ t -> Immediacy . t val allowed_ints : _ t -> Allowed_ints . t val typename : _ t -> str... |
let int = create typename_of_int Always Allowed_ints . All |
let unit = create typename_of_unit Always ( Allowed_ints . From_zero_to 0 ) |
let bool = create typename_of_bool Always ( Allowed_ints . From_zero_to 1 ) |
let char = create typename_of_char Always ( Allowed_ints . From_zero_to 255 ) |
module Computation_impl = struct type nonrec ' a t = ' a t include Type_generic . Variant_and_record_intf . M ( struct type nonrec ' a t = ' a t end ) include Never_values let ref_ _ = ref_ let array _ = array let tuple2 _ _ = tuple2 let tuple3 _ _ _ = tuple3 let tuple4 _ _ _ _ = tupl... |
module Generic = Type_generic . Make ( Computation_impl ) |
let of_typerep typerep = let ( ` generic t ) = Generic . of_typerep typerep in t ; ; |
module For_all_parameters ( M : sig val immediacy : Immediacy . t end ) = struct let witness typerep1 typerep2 = let t1 = of_typerep typerep1 in let t2 = of_typerep typerep2 in let i1 = immediacy t1 in let i2 = immediacy t2 in if not ( Immediacy . equal i1 i2 ) then failwith ( sprintf " type % ... |
let int_is_value t int = Allowed_ints . int_is_value ( allowed_ints t ) int |
let int_as_value ( type a ) ( t : a t ) int = if int_is_value t int then Some ( Obj . magic ( int : int ) : a ) else None ; ; |
let int_as_value_exn ( type a ) ( t : a t ) int = if int_is_value t int then ( Obj . magic ( int : int ) : a ) else failwith ( sprintf " Immediate . int_as_value_exn : typename :% S int :% d " ( T . typename t ) int ) ; ; |
let value_as_int_exn ( type a ) ( t : a t ) a = if Obj . is_int ( Obj . repr a ) then ( Obj . magic ( a : a ) : int ) else failwith ( sprintf " Immediate . value_as_int_exn : typename :% S " ( T . typename t ) ) ; ; |
let value_as_int ( type a ) ( _ : a t ) a = if Obj . is_int ( Obj . repr a ) then Some ( Obj . magic ( a : a ) : int ) else None ; ; |
let value_is_int ( type a ) ( _ : a t ) a = Obj . is_int ( Obj . repr a ) |
module Always = struct type nonrec ' a t = ' a t include For_all_parameters ( struct let immediacy = Always end ) let of_typerep typerep = let t = of_typerep typerep in match immediacy t with | Always -> Some t | Never | Sometimes -> None ; ; let of_typerep_exn here typerep = Option . value_exn... |
module Sometimes = struct type nonrec ' a t = ' a t include For_all_parameters ( struct let immediacy = Sometimes end ) let of_typerep typerep = let t = of_typerep typerep in match immediacy t with | Sometimes -> Some t | Always | Never -> None ; ; let of_typerep_exn here typerep = Option . val... |
module Never = struct type nonrec ' a t = ' a t include For_all_parameters ( struct let immediacy = Never end ) let of_typerep typerep = let t = of_typerep typerep in match immediacy t with | Never -> Some t | Always | Sometimes -> None ; ; let of_typerep_exn here typerep = Option . value_exn ... |
type ' a dest = | Always of ' a Always . t | Sometimes of ' a Sometimes . t | Never of ' a Never . t |
let dest t = let module I = Immediacy in match immediacy t with | I . Always -> Always t | I . Sometimes -> Sometimes t | I . Never -> Never t ; ; |
( module struct module Typerep_obj = Typerep_lib . Std . Typerep_obj type ' a t = { int_as_value : int -> ' a option ; int_as_value_exn : int -> ' a ; int_is_value : int -> bool ; value_as_int : ' a -> int option ; value_as_int_exn : ' a -> int ; value_is_int : ' a -> bool } ... |
( module struct type t = | Always | Sometimes | Never let imm_t = typerep_of_unit let box_t = typerep_of_ref typerep_of_int let is_imm v = Obj . is_int ( Obj . repr v ) let check expected typerep list = if List . length list = 0 then failwith " Must provide at least one test case . " ; let... |
let hash_string_hex s = let md5_hex = Digest . string s |> Digest . to_hex in assert ( String . length md5_hex = 32 ) ; String . sub md5_hex 0 7 |
let is_alpha c = match c with | ' A ' . . ' Z ' | ' a ' . . ' z ' -> true | _ -> false |
let force_capitalize s = let need_prefix = s = " " || not ( is_alpha s . [ 0 ] ) in if need_prefix then capital_prefix ^ s else String . capitalize_ascii s |
let name_of_token ( token : token ) = Punct . to_alphanum token . name |
let encode_prec_name name = for i = 0 to String . length name - 1 do match name . [ i ] with | ' A ' . . ' Z ' | ' a ' . . ' z ' | ' 0 ' . . ' 9 ' -> ( ) | c -> failwith ( sprintf " Unsupported character % C in named precedence level % S " c name ) ... |
let name_of_num_prec n = if n >= 0 then sprintf " p % d " n else sprintf " n % d " ( abs n ) |
let name_of_prec_value ( p : Tree_sitter_t . prec_value ) = match p with | Num_prec n -> name_of_num_prec n | Named_prec name -> sprintf " x % s " ( encode_prec_name name ) |
let name_of_opt_prec_value p = match p with | None -> " 0 " | Some p -> " x " ^ name_of_prec_value p |
let name_ts_rule_body ( body : Tree_sitter_t . rule_body ) = let open Tree_sitter_t in let rec name_rule_body body = match body with | SYMBOL ident -> ident | STRING s -> Punct . to_alphanum s | BLANK -> " blank " | PATTERN pat -> " pat_ " ^ hash_string_hex pat | REPEAT x -> " rep_ " ... |
let name_rule_body body = let rec name_rule_body body = match body with | Symbol ident -> ident | Token token -> name_of_token token | Blank -> " blank " | Repeat body -> " rep_ " ^ name_rule_body body | Repeat1 body -> " rep1_ " ^ name_rule_body body | Choice ( ( _name , body ) :: ... |
let hash_rule_body body = let buf = Buffer . create 100 in let rec aux = function | Symbol ident | Alias ( ident , _ ) -> Buffer . add_string buf ident | Token token -> Buffer . add_string buf token . name | Blank -> Buffer . add_string buf " blank " | Repeat body -> Buffer . add_str... |
let assign_case_names ? rule_name : opt_rule_name cases = let initial_naming = List . mapi ( fun pos rule_body -> let case_name = name_rule_body rule_body in let name = force_capitalize case_name in ( name , ( pos , rule_body ) ) ) cases in let grouped = Util_list . group_by_key initial_nami... |
let again = ref false |
let rec signature : Env . t -> Signature . t -> Signature . t = fun env sg -> let env = Env . open_signature sg env in signature_items env sg fun env s -> let open Signature in let items = List . map ( fun item -> match item with | Module ( r , m ) -> Module ( r , module_ env m ) | M... |
let signature env = let rec loop sg = again := false ; let sg ' = signature env sg in Tools . reset_caches ( ) ; if ! again then if sg ' = sg then sg else loop sg ' else sg ' in loop |
module Variant_kind = struct type t = Polymorphic | Non_polymorphic let to_string_prefix = function | Polymorphic -> " ` " | Non_polymorphic -> " " end |
module Result = struct type t = | Obj_boxed_traversable | Obj_boxed_not_traversable | Obj_immediate | Obj_immediate_but_should_be_boxed | Unit | Abstract of Path . t | Array of Types . type_expr * Env . t | List of Types . type_expr * Env . t | Tuple of Types . type_expr list * Env . t | Ch... |
module Make ( D : Debugger . S ) ( Cmt_cache : Cmt_cache_intf . S ) = struct module V = D . Value module Abstraction_breaker = Abstraction_breaker . Make ( D ) ( Cmt_cache ) type maybe_boxed = Unboxed of V . t | Boxed of V . t | Absent type t = { abstraction_breaker : Abstraction... |
module type TYPE = sig val _type : env -> ( Loc . t , Loc . t ) Ast . Type . t val type_identifier : env -> ( Loc . t , Loc . t ) Ast . Identifier . t val type_params : env -> ( Loc . t , Loc . t ) Ast . Type . TypeParams . t option val type_args : env -> ( Loc . ... |
module Type ( Parse : Parser_common . PARSER ) : TYPE = struct type param_list_or_type = | ParamList of ( Loc . t , Loc . t ) Type . Function . Params . t ' | Type of ( Loc . t , Loc . t ) Type . t let maybe_variance env = let loc = Peek . loc env in match Peek . token en... |
module Make ( D : Debugger . S ) ( Cmt_cache : Cmt_cache_intf . S ) ( Type_helper : Type_helper_intf . S with module Cmt_cache := Cmt_cache with module D := D ) = struct type t = { cmt_cache : Cmt_cache . t ; } let create cmt_cache = { cmt_cache ; } let print_given_type_and_env ... |
module type S = sig module Cmt_cache : Cmt_cache_intf . S type t val create : Cmt_cache . t -> t val print_given_type_and_env : ? variable_name : string -> ? always_print : unit -> Format . formatter -> ( Cmt_file . core_or_module_type * Env . t * Is_parameter . t ) option -> bool val pri... |
let var ( n : int ) int = Var ( Var " v " ^ string_of_int n ) n |
let const c = Term ( c [ ] ) , |
let new_int , reset_new_int = let c = ref ( - 1 ) 1 in ( fun ( ) -> incr c ; ! c ) c , ( fun ( ) -> c := - 1 ) |
let unop_type k = match k with | Ml_fst -> let a = var ( new_int ( new_int ) new_int ) new_int and b = var ( new_int ( new_int ) new_int ) new_int in pair ( paira , b ) b , a | Ml_snd -> let a = var ( new_int ( new_int ) new_int ) new_int and b = var ( new_int ( new_int ) ... |
let binop_type k = match k with | Ml_add | Ml_sub | Ml_mult -> ( const " int " , const " int " , const " int ) " | Ml_eq | Ml_gt | Ml_less -> ( const " int " , const " int " , const " bool ) " |
let generate_type_constraints e = begin reset_new_int ( reset_new_int ) reset_new_int ; let rec gen n tenv = function | <: me < $ int : _ $ >> -> [ var n , const " int ] " | <: me < $ bool : _ $ >> -> [ var n , const " bool ] " | <: me < fst $ _ $ >> -> let t1 , t... |
type simple = A of int |
type u = A of int |
type u = [ ` a | ` b ] ; ; |
type u = v = A of int ; ; |
type u = v = private A of int ; ; |
type ' a ab = [ < ` a ` | b ] as ' a |
type ' a ac = ' a constraint ' a = [ < ` a | ` c ] |
type ( ' a , ' b ) m = [ < ` m of ' a ab & ' a ac ] as ' b |
type _ a = A : int -> int a |
type _ a = A : int -> int a | B : int -> float a |
type ( ' u , ' v ) a = | A of int list * bool | B of bool |
type gram = { gfilter : filter ; gkeywords ( : string , int ref ) Hashtbl . t ; glexer : ( FanLoc . t -> ( char Stream . t -> ( token * FanLoc . t ) Stream . t ) ) ; warning_verbose : bool ref ; error_verbose : bool ref } [ ` Smeta of ( string * symbol list * Act... |
type ' + a my = H of ' a | D ; ; |
type ( ' + a , ' - b ) u = H of ' a | D of ( ' b -> int ) |
type ' a item_or_def = | SdStr of ' a | SdDef of string ( * string list * Ast . expr ) option | SdUnd of string | SdITE of bool ' * a item_or_def list ' * a item_or_def list | SdLazy of ' a Lazy . t |
type s = ? u : int -> int -> int |
let parse_expr ( ? keywords = Lexer_raw . keywords [ ] ) expr = let lexbuf = Lexing . from_string expr in let state = Lexer_raw . make keywords in let rec lexer = function | Lexer_raw . Fail ( e , l ) -> raise ( Lexer_raw . Error ( e , l ) ) | Lexer_raw . Return token -> to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.