text stringlengths 12 786k |
|---|
let get_global conn index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' G ' ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv |
let get_accu conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' A ' ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv |
let get_header conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' H ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt hdr = Lwt_io . BE . read_int conn . io . in_ in Lwt . return hdr ) hdr |
let get_field conn rv index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' F ' ; % lwt _write_remote_value conn rv ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt res = match % lwt Lwt_io . read_char conn . io . in_ with | ' \ 000 ' -> let... |
let marshal_obj conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' M ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt v = Lwt_io . read_value conn . io . in_ in Lwt . return v ) v |
let get_closure_code conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' C ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt pc = _read_pc conn in Lwt . return pc ) pc |
type t = | Varint | Sixty_four | Length_delimited | Start_group | End_group | Thirty_two |
let of_int = function | 0 -> Varint | 1 -> Sixty_four | 2 -> Length_delimited | 3 -> Start_group | 4 -> End_group | 5 -> Thirty_two | n -> Printf . kprintf invalid_arg " Wire_type . of_int ( % d ) " n |
let to_int = function | Varint -> 0 | Sixty_four -> 1 | Length_delimited -> 2 | Start_group -> 3 | End_group -> 4 | Thirty_two -> 5 |
let to_string = function | Varint -> " Varint " | Sixty_four -> " Sixty_four " | Length_delimited -> " Length_delimited " | Start_group -> " Start_group " | End_group -> " End_group " | Thirty_two -> " Thirty_two " |
let pp fmt v = Format . pp_print_string fmt ( to_string v ) |
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " WithdrawByoipCidr ... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " WithdrawByoipCidrResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp WithdrawByoipCidrResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well fo... |
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N... |
let invalid name loc = Invalid_argument ( Printf . sprintf " % s called from % s " name loc ) |
module Option = struct let get ~ loc = function | Some v -> v | None -> raise ( invalid " Lwtreslib . WithExceptions . Option . get " loc ) let to_exn ~ none = function Some v -> v | None -> raise none let to_exn_f ~ none = function Some v -> v | None -> raise ( none ( ) ) end |
module Result = struct let get_ok ~ loc = function | Ok v -> v | Error _ -> raise ( invalid " Lwtreslib . WithExceptions . Result . get_ok " loc ) let get_error ~ loc = function | Error e -> e | Ok _ -> raise ( invalid " Lwtreslib . WithExceptions . Result . get_error " loc ) ... |
module List = struct let rev_combine ~ loc xs ys = let rec aux acc xs ys = match ( xs , ys ) with | ( [ ] , [ ] ) -> acc | ( x :: xs , y :: ys ) -> aux ( ( x , y ) :: acc ) xs ys | ( [ ] , _ :: _ ) | ( _ :: _ , [ ] ) -> raise ( invalid " Lw... |
module type S_bigarray = sig open Bigarray type ' a t val bigstring : ( char , int8_unsigned_elt , c_layout ) Array1 . t t val float32_vec : ( float , float32_elt , fortran_layout ) Array1 . t t val float64_vec : ( float , float64_elt , fortran_layout ) Array1 . t t val float32_mat ... |
module type S = sig type ' a t val unit : unit t val bool : bool t val char : char t val string : string t val int : int t val int32 : int32 t val int63 : Int63 . t t val int64 : int64 t val nativeint : nativeint t val float : float t val sexp : Sexp . t t val option : ' a t -> ' a option t val ... |
let ( ) = Css . install_css ( ) |
module Legend_model = struct type t = { visibility : bool list } [ @@ deriving equal , fields ] end |
let id = Type_equal . Id . create ~ name " : dygraph " [ % sexp_of : opaque ] |
let widget ? with_graph ? on_zoom data options = let resize_when_inserted_into_the_dom graph _time = Graph . resize graph in let override_zoom_callback ~ graph options = match on_zoom with | None -> options | Some on_zoom -> let zoomCallback = let caller ' s_zoom_callback = Options . zoomCallback opt... |
let create_graph ? with_graph ? on_zoom data options = let on_zoom = match on_zoom with | None -> Bonsai . Value . return None | Some on_zoom -> Bonsai . Value . map on_zoom ~ f : Option . some in return ( let % map . Bonsai data = data and options = options and on_zoom = on_zoom in widget ... |
let create_options ~ x_label ~ y_labels ~ visibility ~ legendFormatter = let labels = x_label :: y_labels in let hidden_legend = Dom_html . createDiv Dom_html . document in Options . create ( ) ~ xlabel : x_label ~ labels ~ visibility ~ legend ` : always ~ labelsDiv_el : hidden_legend ~ leg... |
let create_default_legend ~ x_label ~ per_series_info = let % sub model , view , inject = Default_legend . create ~ x_label ~ per_series_info in let model = let % map model = model in { Legend_model . visibility = List . map model . series ~ f : Default_legend . Model . Series . is_visi... |
let format_legend inject_legend_data options data = let caller ' s_legend_formatter = Option . bind options ~ f : Options . legendFormatter in Option . iter caller ' s_legend_formatter ~ f ( : fun f -> ignore ( f data : string ) ) ; Vdom . Effect . Expert . handle_non_dom_event_exn ( ... |
let build_options options visibility legendFormatter x_label y_labels = let our_options = create_options ~ x_label ~ y_labels ~ visibility ~ legendFormatter in match options with | None -> our_options | Some options -> Options . merge options ~ prefer : our_options ; ; |
let visibility ~ legend_model ~ num_series = let visibility = let % map . Bonsai visibility_from_legend = legend_model >>| Legend_model . visibility and num_series = num_series in let visibility_len = List . length visibility_from_legend in if visibility_len < num_series then ( let padding = List . ... |
let create ~ key ~ x_label ~ per_series_info ? custom_legend ? options ? with_graph ? on_zoom ~ data ( ) = let options = Option . value_map options ~ default ( : Bonsai . Value . return None ) ~ f ( : Bonsai . Value . map ~ f : Option . some ) in let % sub legend = match custom... |
module type s = sig class type c = object method m : int end } ] | |
module type s = sig class type ct = object method m : int end } ] | |
module type s = sig type top and t = private < . . > and mid and u = private < . . > and v with type u = private < . . > |
module type s = sig type top and t = private < . . > and mid and u = private < . . > and v end } ] | |
let f x = match x with |
let f = fun x -> match x with |
let f = let g x = match x with | ` A -> " A " | ` B -> " B " in g |
let f = let g = function | ` A -> " A " | ` B -> " B " in g |
let f = let g = fun x -> match x with | ` A -> " A " | ` B -> " B " in g |
let z = begin match x with | X -> x end |
let config_converter = ( fun str -> try ignore ( IndentConfig . update_from_string IndentConfig . default str ) ; ` Ok str with Invalid_argument s -> ` Error s ) , ignore ( IndentConfig . update_from_string IndentConfig . default str ) ; ` Ok str |
let f = try match a with B -> x with C -> y |
let g = try match X with | X -> X with | X -> Y |
type ' a return = { return : ' b . ' a -> ' b } [ @@ unboxed ] |
let with_return ( type a ) f = let module M = struct exception Return of a end in let is_alive = ref true in let return a = if not ! is_alive then failwith " use of [ return ] from a [ with_return ] that already returned " ; Exn . raise_without_backtrace ( M . Return a ) in try let a = f... |
let with_return_option f = with_return ( fun return -> f { return = ( fun a -> return . return ( Some a ) ) } ; None ) ; ; |
let prepend { return } ~ f = { return = ( fun x -> return ( f x ) ) } |
let str s = Sexp . Atom s |
let list l = Sexp . List l |
let ns_to_string = function | [ base ] -> [ base ] | base :: rst -> let seps = [ " . " ; " __ " ] in List . map ( fun sep -> base ^ sep ^ String . concat " . " rst ) seps | _ -> assert false |
let ns_expend ns m = let m = of_coq_name m in match ns with " " -> m | ns -> ns ^ " . " ^ m |
let type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts typ = let coqt = ns_expend coqns ( Conflict . get_coq_type rev_namespace conflicts ~ ty : typ . type_name ) in List . map ( fun sep -> list [ str ( libname ^ sep ^ String . concat " . " ( List . rev ( typ . type_name ... |
let mutually_recursive_type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts mt = Compat . concat_map ( type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts ) mt |
let rec intro_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts = function | Right mt -> mutually_recursive_type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts mt | Left m -> let rev_namespace = m . mod_name :: rev_namespace in let coqmod = Conflict . get_coq_module conflicts ~ m : m . mod_... |
let of_mod ~ coqns conflicts m = mod_to_sexp ~ libname ( : List . hd m . mod_namespace ) ~ rev_namespace [ : m . mod_name ] ~ coqns conflicts m |
let pp fmt witness = let open Format in fprintf fmt " [ @< v 2 ( > translations % a ) ] " @ ( Pp . pp_list ~ pp_prefix : pp_print_space ~ pp_sep : pp_print_space Sexp . pp ) witness |
module Node : Printable . S with type t = MyCFG . node = struct include Var let to_yojson = Node . to_yojson let show = Node . show_cfg let pretty = Node . pretty_trace let printXml f x = BatPrintf . fprintf f " < value >\ n < data >\ n % s \ n </ data >\ n </ value >\ n " ( XmlUtil .... |
module Edge : Printable . S with type t = MyARG . inline_edge = struct type t = MyARG . inline_edge [ @@ deriving to_yojson ] let equal = Util . equals let compare = Stdlib . compare let hash = Hashtbl . hash let name ( ) = " edge " let pretty = MyARG . pretty_inline_edge include Pri... |
module PathSensitive3 ( Spec : Spec ) : Spec = struct module I = struct include Spec . D let to_int = tag let name ( ) = " D " let printXml f d = BatPrintf . fprintf f " < value >% a </ value " > printXml d end module CC = struct include Spec . C let name ( ) = " C " let print... |
module NH = Hashtbl . Make ( Node ) |
module NS = Set . Make ( Node ) |
let find_main_entry entrystates = let ( main_entry_nodes , other_entry_nodes ) = entrystates |> List . map fst |> List . partition ( function | FunctionEntry f , _ -> f . svar . vname = " main " | _ , _ -> false ) in match main_entry_nodes , other_entry_nodes with | [ ] , ... |
let find_loop_heads ( module Cfg : CfgForward ) ( file : Cil . file ) : unit NH . t = let loop_heads = NH . create 100 in let global_visited_nodes = NH . create 100 in let rec iter_node path_visited_nodes node = if NS . mem node path_visited_nodes then NH . replace loop_heads node ( ) e... |
module type File = sig val file : Cil . file end |
module Invariant ( File : File ) ( Cfg : MyCFG . CfgBidir ) = struct let emit_loop_head = GobConfig . get_bool " witness . invariant . loop - head " let emit_after_lock = GobConfig . get_bool " witness . invariant . after - lock " let emit_other = GobConfig . get_bool " witness... |
module InvariantExp = struct module ES = SetDomain . Make ( CilType . Exp ) let rec pullOutCommonConjuncts e = let rec to_conjunct_set = function | Cil . BinOp ( LAnd , e1 , e2 , _ ) -> ES . join ( to_conjunct_set e1 ) ( to_conjunct_set e2 ) | e -> ES . singleton e in let combin... |
type parsing_sate = Initial | EntRef of int ; ; |
let internal_break_words b t = |
let is_whitespace = function | ' ' | ' \ t ' | ' \ n ' | ' \ r ' -> true | _ -> false |
let words_of_string s = let len = String . length s in let finish acc = List . rev acc in let rec iter acc = function | ` Skip next_ofs when next_ofs >= len -> finish acc | ` Skip next_ofs -> if is_whitespace s . [ next_ofs ] then iter acc ( ` Skip ( next_ofs + 1 ) ) else iter acc ( ... |
type t = { count : int ref ; dict : ( string , int ) Hashtbl . t ; outputs : ( Pipeline . label , Bi_outbuf . t ) Hashtbl . t ; } |
let task_init _ = { count = ref 0 ; dict = ( Hashtbl . create ( 1024 * 1024 ) : ( string , int ) Hashtbl . t ) ; outputs = ( Hashtbl . create mAX_LABEL : ( Pipeline . label , Bi_outbuf . t ) Hashtbl . t ) ; } |
let label_of disco word = if disco . Task . grouping = Pipeline . Group_all then 0 else let h = ref 0 in String . iter ( fun c -> h := ! h + Char . code c ) word ; ! h mod mAX_LABEL |
let output_of init disco label = try Hashtbl . find init . outputs label with Not_found -> let o = Bi_outbuf . create_channel_writer ( disco . Task . out_channel ~ label ) in Hashtbl . add init . outputs label o ; o |
let task_done init disco = Hashtbl . iter ( fun k v -> Wc_b . write_wc ( output_of init disco ( label_of disco k ) ) ( k , v ) ; ) init . dict ; Hashtbl . iter ( fun _l o -> Bi_outbuf . flush_channel_writer o ) init . outputs ; disco . Task . log ( Printf . sprintf " ... |
module MapTask = struct module T = Task type init = t let task_init = task_init let task_process init disco in_chan = disco . T . log ( Printf . sprintf " Processing % s ( % d bytes ) with label % d on % s . . . \ n " disco . T . input_url disco . T . input_size disco . T . g... |
module ReduceTask = struct module T = Task type init = t let task_init = task_init let task_process init disco in_chan = disco . T . log ( Printf . sprintf " Processing % s ( % d bytes ) with label % d on % s . . . \ n " disco . T . input_url disco . T . input_size disco . T . ... |
let _ = Worker . start [ ( mAP , ( module MapTask : Task . TASK ) ) ; ( sHUFFLE , ( module ReduceTask : Task . TASK ) ) ; ( rEDUCE , ( module ReduceTask : Task . TASK ) ) ] |
module Single = struct module Spec = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type ( ' witness , ' ledger_proof ) ' ledger_proof t = | Transition of Transaction_snark . Statement . Stable . V2 . t * ' witness | Mer... |
module Spec = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type ' single t = { instances : ' single One_or_two . Stable . V1 . t ; fee : Currency . Fee . Stable . V1 . t } [ @@ deriving fields , sexp , to_yojson ] ... |
module Result = struct [ %% versioned module Stable = struct module V1 = struct type ( ' spec , ' single ) ' single t = { proofs : ' single One_or_two . Stable . V1 . t ; metrics : ( Core . Time . Stable . Span . V1 . t * [ ` Transition | ` Merge ] ) One_or_two . Stable .... |
module Book_view = struct module Visibility = struct type t = | Hidden | Very_hidden | Visible [ @@ deriving sexp_of ] let of_string = function | " hidden " -> Hidden | " veryHidden " -> Very_hidden | " visible " -> Visible | str -> failwithf " Expected ST_Visibility but got ' % s '... |
module Sheet = struct module State = struct type t = | Hidden | Very_hidden | Visible [ @@ deriving sexp_of ] let of_string = function | " hidden " -> Hidden | " veryHidden " -> Very_hidden | " visible " -> Visible | str -> failwithf " Expected ST_SheetState but got ' % s ' " st... |
type t = { book_views : Book_view . t list ; sheets : Sheet . t list } [ @@ deriving fields , sexp_of ] |
let empty = { book_views = [ ] ; sheets = [ ] } |
let of_xml = expect_element " workbook " ( fun _ -> List . fold ~ init : empty ~ f ( : fun t -> let open Xml in function | Element ( " bookViews " , _ , children ) -> let book_views = List . filter_map children ~ f : Book_view . of_xml in { t with book_views } | Element ( ... |
type worker_name = { base : string ; name : string } |
type Error_monad . error += Closed of worker_name |
let ( ) = register_error_kind ` Permanent ~ id " : worker . closed " ~ title " : Worker closed " ~ description : " An operation on a worker could not complete before it was shut down . " ~ pp ( : fun ppf w -> Format . fprintf ppf " Worker % s [ % s ] has been shut down . " ... |
module type T = sig module Name : Worker_intf . NAME module Event : Worker_intf . EVENT module Request : Worker_intf . REQUEST module Types : Worker_intf . TYPES type ' kind t type ' kind table type ' a queue and bounded and infinite type dropbox type _ buffer_kind = | Queue : infinite queue buff... |
module Make ( Name : Worker_intf . NAME ) ( Event : Worker_intf . EVENT ) ( Request : Worker_intf . REQUEST ) ( Types : Worker_intf . TYPES ) ( Logger : Worker_intf . LOGGER with module Event = Event and type Request . view = Request . view ) = struct module Name = Name module... |
let build_rpc_directory state = let dir : unit RPC_directory . t ref = ref RPC_directory . empty in let register0 s f = dir := RPC_directory . register ! dir s ( fun ( ) p q -> f p q ) in let register1 s f = dir := RPC_directory . register ! dir s ( fun ( ( ) , a ) p q -> f a p q ... |
module type NAME = sig val base : string list type t val encoding : t Data_encoding . t val pp : Format . formatter -> t -> unit val equal : t -> t -> bool end |
module type VIEW = sig type view val encoding : view Data_encoding . t val pp : Format . formatter -> view -> unit end |
module type EVENT = sig type t include VIEW with type view := t val level : t -> Internal_event . level end |
module type REQUEST = sig type ' a t include VIEW val view : ' a t -> view end |
module type TYPES = sig type state type parameters end |
module type LOGGER = sig module Event : EVENT module Request : VIEW type status = | WorkerEvent of ( Event . t * Internal_event . level ) | Request of ( Request . view * Worker_types . request_status * error list option ) | Terminated | Timeout | Crashed of error list | Started of string op... |
module type STATIC = sig val worker_name : string end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.