text stringlengths 0 601k |
|---|
let delete_csv delim = csv_params ~ event " : delete " delim " " |
let csv_generator_wrapper default_params rel_sch extra_params = let p = ( List . filter ( fun ( k , v ) -> not ( List . mem_assoc k extra_params ) ) default_params ) @ extra_params in csv_generator rel_sch p |
let bids_params = [ ( " book " , " bids " ) ] |
let asks_params = [ ( " book " , " asks " ) ] |
let orderbook_generator rel_sch params = let required = [ " book " ] in let optional = [ ( " brokers " , " 0 " ) ; ( " insert - only " , " false " ) ] in let valid = List . for_all ( fun k -> List . mem_assoc k params ) required in if not ( valid ) then List . iter ( fun k -> if not ( List . mem_assoc k params ) then f... |
let generators = [ ( " csv " , standard_generator ) ; ( " orderbook " , orderbook_generator ) ] |
let initialize ( ) = List . iter ( fun ( x , y ) -> Adaptors . add x y ) generators |
let fp_div ( arglist : const_t list ) ( ftype : type_t ) = begin match arglist with | [ v ] -> Constants . Math . div1 ftype v | [ v1 ; v2 ] -> Constants . Math . div2 ftype v1 v2 | _ -> invalid_args " fp_div " arglist ftype end ( function | ( ( [ _ ; _ ] as x ) | ( [ _ ] as x ) ) -> ( escalate ( TFloat :: x ) ) | _ ->... |
let min_of_list ( arglist : const_t list ) ( ftype : type_t ) = let ( start , cast_type ) = match ftype with TInt -> ( CInt ( max_int ) , TInt ) | TAny | TFloat -> ( CFloat ( max_float ) , TFloat ) | _ -> ( invalid_args " listmin " arglist ftype , TAny ) in List . fold_left min start ( List . map ( Constants . type_cas... |
let max_of_list ( arglist : const_t list ) ( ftype : type_t ) = let ( start , cast_type ) = match ftype with TInt -> ( CInt ( min_int ) , TInt ) | TAny | TFloat -> ( CFloat ( min_float ) , TFloat ) | _ -> ( invalid_args " listmax " arglist ftype , TAny ) in List . fold_left max start ( List . map ( Constants . type_cas... |
let date_part ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CString ( part ) ; CDate ( y , m , d ) ] -> begin match String . uppercase_ascii part with | " YEAR " -> CInt ( y ) | " MONTH " -> CInt ( m ) | " DAY " -> CInt ( d ) | _ -> invalid_args " date_part " arglist ftype end | _ -> invalid_ar... |
let regexp_match ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CString ( regexp ) ; CString ( str ) ] -> Debug . print " LOG - REGEXP " ( fun ( ) -> " " /^ regexp " ^/ =~ ' " ^ str " ' " ) ; ^ if Str . string_match ( Str . regexp regexp ) str 0 then CInt ( 1 ) else CInt ( 0 ) | _ -> invalid_arg... |
let substring ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CString ( str ) ; CInt ( start ) ; CInt ( len ) ] -> CString ( String . sub str start len ) | [ CChar ( c ) ; CInt ( 0 ) ; CInt ( 1 ) ] -> CChar ( c ) | _ -> invalid_args " substring " arglist ftype ( function [ TString ; TInt ; TInt ]... |
type vector_t = float * float * float |
let vec_of_list ( v : float list ) : vector_t = match v with | [ x ; y ; z ] -> ( x , y , z ) | _ -> failwith " vector is not 3D " ; ; ! |
let calc_vec_length ( v1 : vector_t ) : float = let ( x1 , y1 , z1 ) = v1 in sqrt ( x1 . * x1 . + y1 . * y1 . + z1 . * z1 ) ; ; |
let calc_vec_dot ( v1 : vector_t ) ( v2 : vector_t ) : float = let ( x1 , y1 , z1 ) = v1 in let ( x2 , y2 , z2 ) = v2 in x1 . * x2 . + y1 . * y2 . + z1 . * z2 ; ; |
let calc_vec_angle ( v1 : vector_t ) ( v2 : vector_t ) : float = acos ( calc_vec_dot ( v1 ) ( v2 ) . / ( calc_vec_length ( v1 ) . * calc_vec_length ( v2 ) ) ) |
let calc_vec_cross ( v1 : vector_t ) ( v2 : vector_t ) : vector_t = let ( x1 , y1 , z1 ) = v1 in let ( x2 , y2 , z2 ) = v2 in let x = ( y1 . * z2 . - z1 . * y2 ) in let y = ( z1 . * x2 . - x1 . * z2 ) in let z = ( x1 . * y2 . - y1 . * x2 ) in ( x , y , z ) ; ; |
let calc_dihedral_angle ( inputs : float list ) : float = match inputs with | [ x1 ; y1 ; z1 ; x2 ; y2 ; z2 ; x3 ; y3 ; z3 ; x4 ; y4 ; z4 ] -> let v1_x = x2 . - x1 in let v1_y = y2 . - y1 in let v1_z = z2 . - z1 in let v2_x = x3 . - x2 in let v2_y = y3 . - y2 in let v2_z = z3 . - z2 in let v3_x = x4 . - x3 in let v3_y ... |
let vec_length ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ; CFloat ( y ) ; CFloat ( z ) ] -> CFloat ( calc_vec_length ( x , y , z ) ) | [ CInt ( x ) ; CInt ( y ) ; CInt ( z ) ] -> let v = List . map float_of_int [ x ; y ; z ] in CFloat ( calc_vec_length ( vec_of_list v ) ) | _ -... |
let vec_dot ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x1 ) ; CFloat ( y1 ) ; CFloat ( z1 ) ; CFloat ( x2 ) ; CFloat ( y2 ) ; CFloat ( z2 ) ] -> let v1 = [ x1 ; y1 ; z1 ] in let v2 = [ x2 ; y2 ; z2 ] in CFloat ( calc_vec_dot ( vec_of_list v1 ) ( vec_of_list v2 ) ) | [ CInt ( x1 ) ; ... |
let vector_angle ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x1 ) ; CFloat ( y1 ) ; CFloat ( z1 ) ; CFloat ( x2 ) ; CFloat ( y2 ) ; CFloat ( z2 ) ] -> let v1 = [ x1 ; y1 ; z1 ] in let v2 = [ x2 ; y2 ; z2 ] in CFloat ( calc_vec_angle ( vec_of_list v1 ) ( vec_of_list v2 ) ) | [ CInt ( ... |
let dihedral_angle ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x1 ) ; CFloat ( y1 ) ; CFloat ( z1 ) ; CFloat ( x2 ) ; CFloat ( y2 ) ; CFloat ( z2 ) ; CFloat ( x3 ) ; CFloat ( y3 ) ; CFloat ( z3 ) ; CFloat ( x4 ) ; CFloat ( y4 ) ; CFloat ( z4 ) ] -> let inputs = [ x1 ; y1 ; z1 ; x2 ; ... |
let hash ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CInt ( x1 ) ] -> CInt ( x1 ) | _ -> invalid_args " hash " arglist ftype |
let pi = 4 . 0 . * atan 1 . 0 ; ; |
let calc_radian ( degree : float ) : float = ( degree . * pi ) . / 180 . 0 |
let radians ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ] -> CFloat ( calc_radian ( x ) ) | [ CInt ( x ) ] -> CFloat ( calc_radian ( float_of_int x ) ) | _ -> invalid_args " radians " arglist ftype |
let calc_degree ( radian : float ) : float = ( radian . * 180 . 0 ) . / pi |
let degrees ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ] -> CFloat ( calc_degree ( x ) ) | [ CInt ( x ) ] -> CFloat ( calc_degree ( float_of_int x ) ) | _ -> invalid_args " degrees " arglist ftype |
let math_sqrt ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ] -> CFloat ( sqrt ( x ) ) | [ CInt ( x ) ] -> CFloat ( sqrt ( float_of_int x ) ) | _ -> invalid_args " sqrt " arglist ftype |
let math_cos ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ] -> CFloat ( cos ( x ) ) | [ CInt ( x ) ] -> CFloat ( cos ( float_of_int x ) ) | _ -> invalid_args " cos " arglist ftype |
let math_pow ( arglist : const_t list ) ( ftype : type_t ) = match arglist with | [ CFloat ( x ) ; CFloat ( y ) ] -> CFloat ( x ** y ) | [ CInt ( x ) ; CInt ( y ) ] -> CFloat ( ( float_of_int x ) ** ( float_of_int y ) ) | [ CInt ( x ) ; CFloat ( y ) ] -> CFloat ( ( float_of_int x ) ** ( y ) ) | [ CFloat ( x ) ; CInt ( ... |
let cast ( arglist : const_t list ) ( ftype : type_t ) = let arg = match arglist with [ a ] -> a | _ -> invalid_args " cast " arglist ftype in begin try begin match ftype with | TInt -> CInt ( Constants . int_of_const arg ) | TFloat -> CFloat ( Constants . float_of_const arg ) | TDate -> begin match arg with | CDate _ ... |
module Pkg = struct let listing packages = let longest_pkg = String . longest_map packages ~ f ( : fun p -> let name = Package . name p in Package . Name . to_string name ) in Pp . enumerate packages ~ f ( : fun pkg -> let name = Package . name pkg in Printf . ksprintf Pp . verbatim " %-* s ( because of % s ) " longest... |
let modules_field name = Ordered_set_lang . field name |
module Configuration = struct module Align = struct type t = { name : string ; sam_mapq_unique : int option ; overhang_length : int option ; parameters : ( string * string ) list ; } let name t = t . name let default = { name = " default " ; sam_mapq_unique = None ; overhang_length = None ; parameters = [ ] ; } let to_... |
let index ~ reference_build ( ~ run_with : Machine . t ) = let open KEDSL in let reference_fasta = Machine . get_reference_genome run_with reference_build |> Reference_genome . fasta in let star_tool = Machine . get_tool run_with Machine . Tool . Default . star in let name = sprintf " star - index -% s " ( Filename . b... |
let align ~ reference_build ~ fastq ( ~ result_prefix : string ) ( ~ run_with : Machine . t ) ( ? configuration = Configuration . Align . default ) ( ) = let open KEDSL in let reference_fasta = Machine . get_reference_genome run_with reference_build |> Reference_genome . fasta in let in_work_dir = Program . shf " cd % ... |
module ServerEvent = struct module ErrorKind = struct type t = | Watchman | BuckInternal | BuckUser | Pyre | Unknown [ @@ deriving sexp , compare , hash , to_yojson ] end type t = | SocketCreated of PyrePath . t | ServerInitialized | Exception of string * ErrorKind . t [ @@ deriving sexp , compare , hash , to_yojson ] ... |
module ExitStatus = struct type t = | Ok | Error [ @@ deriving sexp , compare , hash ] let exit_code = function | Ok -> 0 | Error -> 1 end |
let with_performance_logging ( ? normals = [ ] ) ~ name f = let open Lwt . Infix in let timer = Timer . start ( ) in f ( ) >>= fun result -> let normals = ( " binary_version " , Version . version ( ) ) :: normals in Statistics . performance ~ name ~ timer ~ normals ( ) ; Lwt . return result |
module ClientRequest = struct type t = | GetInfo | StopServer | Request of Request . t | Subscription of Subscription . Request . t | Error of string [ @@ deriving sexp , compare ] let of_string input_string = try let json = Yojson . Safe . from_string input_string in match json with | ` List [ ` String " GetInfo " ] -... |
let handle_request ~ properties ~ state request = let open Lwt . Infix in let on_uncaught_server_exception exn = Log . info " Uncaught server exception : % s " ( Exn . to_string exn ) ; let ( ) = let { ServerProperties . configuration ; _ } = properties in StartupNotification . produce ~ log_path : configuration . log_... |
let handle_subscription ~ state { : ServerState . subscriptions ; _ } ~ output_channel request = match request with | Subscription . Request . SubscribeToTypeErrors subscriber_name -> let subscription = Subscription . create ~ name : subscriber_name ~ output_channel ( ) in ServerState . Subscriptions . add subscription... |
module ConnectionState = struct type t = { subscription_names : string list } let create ( ) = { subscription_names = [ ] } let add_subscription ~ name { subscription_names } = Log . log ~ section ` : Server " Subscription added : % s " name ; { subscription_names = name :: subscription_names } let cleanup ~ server_sta... |
let handle_connection ~ server_properties ~ server_state _client_address ( input_channel , output_channel ) = let open Lwt . Infix in Log . log ~ section ` : Server " Connection established " ; let rec handle_line connection_state = Lwt_io . read_line_opt input_channel >>= function | None -> Log . log ~ section ` : Ser... |
let create_server_properties ~ configuration { StartOptions . socket_path ; critical_files ; _ } = ServerProperties . create ~ socket_path ~ critical_files ~ configuration ( ) |
let initialize_server_state ? watchman_subscriber ~ build_system_initializer ~ saved_state_action ( { ServerProperties . configuration = { Configuration . Analysis . log_directory ; _ } as configuration ; critical_files ; _ ; } as server_properties ) = let _ = Memory . get_heap_handle configuration in let start_from_sc... |
let get_watchman_subscriber ? watchman ~ watchman_root ~ critical_files ~ extensions ~ source_paths ( ) = let open Lwt . Infix in match watchman_root with | None -> Lwt . return_none | Some root -> let get_raw_watchman = function | Some watchman -> Lwt . return watchman | None -> Watchman . Raw . create_exn ( ) in get_... |
let on_watchman_update ~ server_properties ~ server_state paths = let open Lwt . Infix in let update_request = Request . IncrementalUpdate ( List . map paths ~ f : PyrePath . absolute ) in ExclusiveLock . Lazy . write server_state ~ f ( : fun state -> handle_request ~ properties : server_properties ~ state update_reque... |
let with_server ? watchman ? build_system_initializer ~ configuration ( { : Configuration . Analysis . extensions ; _ } as configuration ) ~ f ( { StartOptions . socket_path ; source_paths ; watchman_root ; critical_files ; saved_state_action } as start_options ) = let open Lwt in get_watchman_subscriber ? watchman ~ w... |
let wait_on_signals ~ on_caught signals = let open Lwt in let waiter , resolver = wait ( ) in List . iter signals ~ f ( : fun signal -> let signal = Signal . to_system_int signal in Lwt_unix . on_signal signal ( wakeup resolver ) |> ignore ) ; waiter >>= fun signal -> let signal = Signal . of_system_int signal in Log .... |
let start_server ? watchman ? build_system_initializer ( ? on_server_socket_ready = fun _ -> Lwt . return_unit ) ~ on_started ~ on_exception ~ configuration start_options = let open Lwt in let f ( socket_path , server_properties , server_state ) = on_server_socket_ready socket_path >>= fun _ -> on_started server_proper... |
let start_server_and_wait ? event_channel ~ configuration start_options = let open Lwt in let write_event event = match event_channel with | None -> return_unit | Some output_channel -> catch ( fun ( ) -> ServerEvent . write ~ output_channel event ) ( function | Lwt_io . Channel_closed _ | Caml . Unix . Unix_error ( Ca... |
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 " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " StartActivityStream " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . re... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " StartActivityStreamResponse " ( snd xml ) ) ( Xml . member " StartActivityStreamResult " ) in try Util . or_error ( Util . option_bind resp StartActivityStreamResponse . parse ) ( let open Error in BadResponse {... |
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 | None -> None |
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 " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " StartDBCluster " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " StartDBClusterResponse " ( snd xml ) ) ( Xml . member " StartDBClusterResult " ) in try Util . or_error ( Util . option_bind resp StartDBClusterResult . parse ) ( let open Error in BadResponse { body ; message =... |
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 | None -> None |
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 " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " StartDBInstance " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " StartDBInstanceResponse " ( snd xml ) ) ( Xml . member " StartDBInstanceResult " ) in try Util . or_error ( Util . option_bind resp StartDBInstanceResult . parse ) ( let open Error in BadResponse { body ; messag... |
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 | None -> None |
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 " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " StartExportTask " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " StartExportTaskResponse " ( snd xml ) ) ( Xml . member " StartExportTaskResult " ) in try Util . or_error ( Util . option_bind resp ExportTask . parse ) ( let open Error in BadResponse { body ; message = " Could... |
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 | None -> None |
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 " , [ " StartInstances " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " StartInstancesResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp StartInstancesResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed StartInstancesResult . " } ) with |... |
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 | None -> None |
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 " , [ " 2015 - 02 - 02 " ] ) ; ( " Action " , [ " StartMigration " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " StartMigrationResponse " ( snd xml ) ) ( Xml . member " StartMigrationResult " ) in try Util . or_error ( Util . option_bind resp StartMigrationResponse . parse ) ( let open Error in BadResponse { body ; message... |
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 | None -> None |
let capability = " [ CAPABILITY IMAP4rev1 LITERAL + SASL - IR LOGIN - REFERRALS ID ENABLE IDLE STARTTLS AUTH = PLAIN ] server ready . \ r \ n " |
let ok_starttls = " OK STARTTLS \ r \ n " |
let cert ( ) = X509_lwt . private_of_pems ~ cert " . :/ certificates / server . pem " ~ priv_key " . :/ certificates / server . key " |
let init_socket addr port = let sockaddr = Unix . ADDR_INET ( Unix . inet_addr_of_string addr , port ) in let socket = Lwt_unix . socket Unix . PF_INET Unix . SOCK_STREAM 0 in Lwt_unix . setsockopt socket Unix . SO_REUSEADDR true ; Lwt_unix . bind socket sockaddr >|= fun ( ) -> socket |
let create_srv_socket addr port = init_socket addr port >|= fun socket -> Lwt_unix . listen socket 10 ; socket |
let accept sock = Lwt_unix . accept sock >>= fun ( sock_cl , addr ) -> let ic = Lwt_io . of_fd ~ close ( : fun ( ) -> Lwt . return_unit ) ~ mode : Lwt_io . input sock_cl in let oc = Lwt_io . of_fd ~ close ( : fun ( ) -> Lwt . return_unit ) ~ mode : Lwt_io . output sock_cl in Lwt . return ( ( ic , oc ) , addr , sock_cl ... |
let start_server ( ) = let write oc buff = Lwt_io . write oc buff >>= fun ( ) -> Lwt_io . flush oc in let read ic = Lwt_io . read ic ~ count : 2048 >>= fun buff -> Printf . printf " % s " %! buff ; Lwt . return buff in let parse buff = match String . index buff ' ' with | exception Not_found -> " " , " " | idx -> let l... |
let ( ) = Lwt_main . run ( start_server ( ) ) |
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 " , [ " StartVpcEndpointServicePrivateDnsVerification " ] ) ] ( Util . drop_empty ( Uri . que... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " StartVpcEndpointServicePrivateDnsVerificationResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp StartVpcEndpointServicePrivateDnsVerificationResult . parse ) ( let open Error in BadResponse { body ; message = " ... |
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 | None -> None |
type t = { a : int32 ; b : int32 } |
let invariant { a ; b } = Compare . Int32 . ( a >= 0l && b >= 0l ) |
let create a b = let st = { a ; b } in if invariant st then Some st else None |
let encoding = Data_encoding . conv ( fun { a ; b } -> ( a , b ) ) ( fun ( a , b ) -> { a ; b } ) Data_encoding . ( obj2 ( req " demo_a " int32 ) ( req " demo_b " int32 ) ) |
let encoding_length = match Data_encoding . Binary . fixed_length encoding with | None -> assert false | Some length -> length |
let get_state context = Context . get context state_key >|= function | None -> assert false | Some encoded_state -> ( match Data_encoding . Binary . of_bytes encoding encoded_state with | Some x -> x | None -> assert false ) |
let update_state context state = let encoded_state = Data_encoding . Binary . to_bytes_exn encoding state in Context . set context state_key encoded_state |
module Make ( AstHelpers : GTHELPERS_sig . S ) = struct |
let trait_name = trait_name inherit G . g initial_args tdecls as super inherit P . with_inherited_attr initial_args tdecls method trait_name = trait_name method ! inh_of_main ~ loc _tdecl = Typ . var ~ loc " env " method ! syn_of_param ~ loc s = Typ . tuple ~ loc [ Typ . var ~ loc " env " ; Typ . var ~ loc @@ Gmap . pa... |
let create = ( new g :> P . plugin_constructor ) end |
let register ( ) = Expander . register_plugin trait_name ( module Make : Plugin_intf . MAKE ) |
let ( ) = register ( ) |
module type MACHINE = sig type t with sexp type cmd with sexp type res with sexp val commit_many : t -> cmd list -> t val init : unit -> t val to_string : t -> string val cmd_to_string : cmd -> string val res_to_string : res -> string val gen_workload : int -> cmd list val gen_results : int -> res list val get_last_res... |
module KeyValStr : MACHINE = struct type mach_cmd = | Add of int * string | Find of int with bin_io , sexp type cmd = int * mach_cmd with bin_io , sexp type res = string option with bin_io , sexp let res_to_string = function | None -> " NotFound " | Some x -> ( " Found " ^ x ) x let mach_cmd_to_string = function | Add ... |
let name_location ~ offset_columns ~ body_location { : Location . start = { line = start_line ; column = start_column } ; _ } name_string = let start_column = start_column + offset_columns in let stop_column_ = let name_length = name_string |> String . length in start_column + name_length in Location . { start = { line... |
module Assign = struct type t = { target : Expression . t ; annotation : Expression . t option ; value : Expression . t ; } [ @@ deriving compare , sexp , show , hash , to_yojson ] let location_insensitive_compare left right = match Expression . location_insensitive_compare left . target right . target with | x when no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.