text stringlengths 12 786k |
|---|
let sexp_of_int64 x = CCSexp . atom @@ Int64 . to_string x |
let sexp_of_int x = CCSexp . atom @@ string_of_int x |
let sexp_list_of_ints l = List . map sexp_of_int l |
let sexp_of_tz_name t = CCSexp . atom ( Timedesc . Time_zone . name t ) |
let sexp_of_points ( { pick ; tz_info } : Points . t ) = let open CCSexp in let open Points in list ( CCList . filter_map CCFun . id [ Some ( atom " points " ) ; Some ( list ( atom " pick " :: ( match pick with | N ns -> [ atom " n " ; sexp_of_int ns ] | SN { se... |
let sexp_of_range ( ~ f : ' a -> CCSexp . t ) ( r : ' a Time . Range . range ) = match r with | ` Range_inc ( x , y ) -> CCSexp . ( list [ atom " range_inc " ; f x ; f y ] ) | ` Range_exc ( x , y ) -> CCSexp . ( list [ atom " range_exc " ; f x ; ... |
let sexp_of_iso_week_pattern ( years : Int_set . t ) ( weeks : Int_set . t ) : CCSexp . t = let years = Int_set . to_list years |> sexp_list_of_ints in let weeks = Int_set . to_list weeks |> sexp_list_of_ints in CCSexp . ( list [ atom " iso_week_pattern " ; list years ; list week... |
let sexp_of_pattern ( pat : Pattern . t ) : CCSexp . t = let years = pat . years |> Int_set . to_list |> sexp_list_of_ints in let months = pat . months |> Int_set . to_list |> List . map sexp_of_month in let month_days = pat . month_days |> Int_set . to_list |> sexp_list_of_ints in let... |
let sexp_list_of_unary_op ( op : Time_ast . unary_op ) = match op with | Not -> [ CCSexp . atom " not " ] | Shift n -> [ CCSexp . atom " shift " ; sexp_of_span n ] | Lengthen n -> [ CCSexp . atom " lengthen " ; sexp_of_span n ] | With_tz tz -> [ CCSexp . atom " wi... |
let to_sexp ( t : Time_ast . t ) : CCSexp . t = let rec aux ( t : Time_ast . t ) = match t with | All -> CCSexp . ( list [ atom " all " ] ) | Empty -> CCSexp . ( list [ atom " empty " ] ) | Intervals s -> let l = s |> CCList . of_seq |> List . map ( fun ( ... |
let wrap_to_sexp_into_to_sexp_string ( f : ' a -> CCSexp . t ) x = CCSexp . to_string ( f x ) |
let to_sexp_string = wrap_to_sexp_into_to_sexp_string to_sexp |
module File_type_specification = struct open Biokepi_run_environment . Common . KEDSL type t = . . type t += | To_unit : t -> t | Fastq : fastq_reads workflow_node -> t | Bam : bam_file workflow_node -> t | Vcf : vcf_file workflow_node -> t | Bed : single_file workflow_node -> t | Gtf : sing... |
module type Compiler_configuration = sig val work_dir : string val results_dir : string option val machine : Machine . t val map_reduce_gatk_indel_realigner : bool val input_files : [ ` Copy | ` Link | ` Do_nothing ] end |
module Defaults = struct let map_reduce_gatk_indel_realigner = true let input_files = ` Link let results_dir = None end |
module Provenance_description = struct type t = { name : string ; sub_tree_arguments : ( string * t ) list ; string_arguments : ( string * string ) list ; json_arguments : ( string * Yojson . Basic . json ) list ; } let rec to_yojson t : Yojson . Basic . json = let fields = L... |
module Annotated_file = struct type t = { file : File_type_specification . t ; provenance : Provenance_description . t ; functional : ( t -> Provenance_description . t ) option ; } let with_provenance ? functional ( ? string_arguments = [ ] ) ( ? json_arguments = [ ] ) nam... |
module Saving_utilities = struct let base_path ? results_dir ~ work_dir ~ name ( ) = let name = String . map name ~ f ( : function | ' 0 ' . . ' 9 ' | ' a ' . . ' z ' | ' A ' . . ' Z ' | ' ' - | ' _ ' as c -> c | other -> ' _ ' ) in match re... |
let get_workflow : name : string -> Annotated_file . t -> unknown_product workflow_node = fun ~ name f -> let v = Annotated_file . get_file f in workflow_node without_product ~ name ~ edges ( : File_type_specification . as_dependency_edges v ) |
module Make ( Config : Compiler_configuration ) : Semantics . Bioinformatics_base with type ' a repr = Annotated_file . t and type ' a observation = Annotated_file . t open File_type_specification module AF = Annotated_file module Tools = Biokepi_bfx_tools module KEDSL = Common . KEDSL let failf ... |
module Id = struct type t = int64 let t = Irmin . Type . int64 let to_string : t -> string = Fmt . to_to_string ( Irmin . Type . pp_json t ) let compare = Int64 . compare let of_int = Int64 . of_int let random ? x y = let x = match x with | Some x -> Int64 . of_int x | None -> 0L in ... |
type item_req = { _ol_num : int32 ; _ol_i_id : id ; _ol_supply_w_id : id ; _ol_qty : int32 } |
let counter_merge lca v1 v2 = let ( ) + a b = Int32 . add a b in let ( ) - a b = Int32 . sub a b in lca + ( v1 - lca ) + ( v2 - lca ) |
let minf f l = List . fold_left ( fun acc x -> match acc with | None -> Some x | Some x ' -> if Int64 . compare ( f x ) ( f x ' ) < 0 then Some x else acc ) None l |
module Warehouse = struct type t = { w_id : id ; w_ytd : int32 } let merge ~ ancestor : lca { w_ytd = y1 } { w_ytd = y2 } = { lca with w_ytd = ( counter_merge lca . w_ytd y1 y2 ) } end |
module District = struct type t = { d_w_id : id ; d_id : id ; d_ytd : int32 ; } let merge ~ ancestor : lca { d_ytd = y1 } { d_ytd = y2 } = { lca with d_ytd = counter_merge lca . d_ytd y1 y2 } end |
module Order = struct type t = { o_w_id : id ; o_d_id : id ; o_id : id ; o_c_id : id ; o_ol_cnt : int32 ; o_carrier_id : bool } let merge ~ ancestor : lca ( { o_carrier_id = b1 } as v1 ) ( { o_carrier_id = b2 } as v2 ) = if lca . o_carrier_id = true then ( assert ( lca ... |
module NewOrder = struct type t = { no_w_id : id ; no_d_id : id ; no_o_id : id } let merge ~ ancestor : lca v1 v2 = failwith " new_order is immutable " end |
module OrderLine = struct type t = { ol_w_id : id ; ol_d_id : id ; ol_o_id : id ; ol_i_id : id ; ol_num : int32 ; ol_supply_w_id : id ; ol_amt : int32 ; ol_qty : int32 ; ol_delivery_d : float option } let merge ~ ancestor : lca { ol_delivery_d = d1 } { ol_delivery_d = d2 } = ... |
module Item = struct type t = { i_id : id ; i_name : string ; i_price : int32 } let merge ~ ancestor v1 v2 = failwith " Item is immutable " end |
module Hist = struct type t = { h_c_id : id ; h_c_d_id : id ; h_c_w_id : id ; h_d_id : id ; h_w_id : id ; h_amt : int32 } let merge ~ ancestor v1 v2 = failwith " Hist is immutable " end |
module Stock = struct type t = { s_w_id : id ; s_i_id : id ; s_qty : int32 ; s_ytd : int32 ; s_order_cnt : int32 } let merge ~ ancestor { : s_i_id ; s_w_id ; s_qty = q ; s_ytd = y ; s_order_cnt = c } { s_qty = q1 ; s_ytd = y1 ; s_order_cnt = c1 } { s_qty = q2 ; s_ytd ... |
module Customer = struct type t = { c_w_id : id ; c_d_id : id ; c_id : id ; c_bal : int32 ; c_ytd_payment : int32 ; c_payment_cnt : int32 ; c_delivery_cnt : int32 ; } let merge ~ ancestor { : c_id ; c_d_id ; c_w_id ; c_bal = b ; c_ytd_payment = y ; c_payment_cnt = p ; c_del... |
module IdPair = struct type t = id * id let t = let open Irmin . Type in pair id id let to_string : t -> string = Fmt . to_to_string ( Irmin . Type . pp_json t ) let compare ( x1 , y1 ) ( x2 , y2 ) = match Id . compare x1 x2 , Id . compare y1 y2 with | 0 , v2 -> v2 | v1 , _... |
module IdTriple = struct type t = id ( * id * id ) let t = let open Irmin . Type in pair id ( pair id id ) let to_string : t -> string = Fmt . to_to_string ( Irmin . Type . pp_json t ) let compare ( x1 , ( y1 , z1 ) ) ( x2 , ( y2 , z2 ) ) = match Id . compare x1 x2... |
module IdQuad = struct type t = id ( * id ( * id * id ) ) let t = let open Irmin . Type in pair id ( pair id ( pair id id ) ) let to_string : t -> string = Fmt . to_to_string ( Irmin . Type . pp_json t ) let compare ( w1 , ( x1 , ( y1 , z1 ) ) ) ( w2 , ( x2 ,... |
module IdQuin = struct type t = id ( * id ( * id ( * id * id ) ) ) let t = let open Irmin . Type in ( pair id ( pair id ( pair id ( pair id id ) ) ) ) let to_string : t -> string = Fmt . to_to_string ( Irmin . Type . pp_json t ) let compare ( u1 , ( w1 , ( x1 ... |
type db = { warehouse_table : WarehouseTable . t ; district_table : DistrictTable . t ; order_table : OrderTable . t ; neworder_table : NewOrderTable . t ; orderline_table : OrderLineTable . t ; item_table : ItemTable . t ; hist_table : HistTable . t ; stock_table : StockTable . ... |
module Txn = struct type ' a t = db -> ' a * db let bind m f = fun db -> let ( a , db ' ) = m db in f a db ' let return a = fun db -> ( a , db ) end |
module Insert = struct let order_table o db = let open Order in let t = db . order_table in let t ' = OrderTable . insert ( o . o_w_id , ( o . o_d_id , o . o_id ) ) o t in ( ( ) , { db with order_table = t ' } ) let neworder_table no db = let open NewOrder in let t = db . ... |
module Update = struct let warehouse_table sigf updf db = let t = db . warehouse_table in let t ' = WarehouseTable . update sigf updf t in ( ( ) , { db with warehouse_table = t ' } ) let district_table sigf updf db = let t = db . district_table in let t ' = DistrictTable . update sig... |
module Delete = struct let neworder_table ( no_w_id , no_d_id , no_o_id ) db = let t = db . neworder_table in let t ' = NewOrderTable . remove ( no_w_id , ( no_d_id , no_o_id ) ) t in ( ( ) , { db with neworder_table = t ' } ) end |
module Select1 = struct open Printf let warehouse_table x db = try let t = db . warehouse_table in let res = WarehouseTable . find x t in ( res , db ) with Not_found -> failwith @@ sprintf " Warehouse <% s > not found " ( Id . to_string x ) let district_table ( x , y ) db = try let t ... |
module Select = struct let warehouse_table sigf db = let t = db . warehouse_table in let res = WarehouseTable . select sigf t in ( res , db ) let district_table sigf db = let t = db . district_table in let res = DistrictTable . select sigf t in ( res , db ) let item_table sigf db = let t = ... |
module Temp = struct let ( ) + = Int32 . add let ( ) - = Int32 . sub let ( * ) = Int32 . mul let ( ) >>= = Txn . bind end |
let dump_stock_keys db = let fp = open_out " stock_keys . db " in let dump2 k v = fprintf fp " % s \ n " @@ IdPair . to_string k in begin fprintf fp " \ n > Stock \ n " ; StockTable . iter dump2 db . stock_table ; close_out fp ; printf " Dumped keys in stock_keys . db \ n " ; ... |
let new_order_txn w_id d_id c_id ( ireqs : item_req list ) : unit Txn . t = let _ = printf " new_order_txn \ n " in let _ = flush_all ( ) in let o_id = Random . int64 10000000000L in let ord = let open Order in { o_id = o_id ; o_w_id = w_id ; o_d_id = d_id ; o_c_id = c_id ; o_ol... |
let payment_txn w_id d_id c_id h_amt = let _ = printf " payment_txn \ n " in let _ = flush_all ( ) in let d_w_id = w_id in let c_w_id = w_id in let c_d_id = d_id in Select1 . warehouse_table ( w_id ) >>= fun w -> Select1 . district_table ( d_w_id , d_id ) >>= fun d -> Select1 . cust... |
let delivery_txn w_id = let _ = printf " delivery_txn \ n " in let _ = flush_all ( ) in Select . district_table ( fun ( dist_w_id , _ ) -> Id . compare dist_w_id w_id ) >>= fun dists -> List . fold_left ( fun pre d -> pre >>= fun ( ) -> Select . neworder_table ( fun ( no... |
let init ( ) = match Sys . getenv_opt " OCAMLI2PARAM " with Some " rules " -> Eval . showrules := true | _ -> ( ) |
let rec to_ocaml_heap_value expr = match expr . e with Value x -> x | ArrayExpr arr -> let x = Obj . new_block 0 ( Array . length arr ) in for i = 0 to Array . length arr - 1 do Obj . set_field x i ( to_ocaml_heap_value arr . ( i ) ) done ; x | Cons ( { e = Value h } , t ) ... |
let eval_full env x = let program = ( Marshal . from_string x 0 : Type . t ) in match Eval . eval_full ! env program with { Type . e = Type . Value x } -> x | x -> to_ocaml_heap_value x |
let eval_full_from_typedtree env x = let typedtree = ( Marshal . from_string x 0 : Typedtree . expression ) in let program = Read . finaltype_of_expression ! env typedtree in match Eval . eval_full ! env program with { Type . e = Type . Value x } -> x | x -> to_ocaml_heap_value x |
let addenv envref printas n v t = let binding = { Type . e = Type . Value v ; Type . typ = Read . debug_type ( Read . remove_links ( Marshal . from_string t 0 : Types . type_expr ) ) ; Type . lets = [ ] ; Type . peek = None ; Type . printbefore = None ; Type . prin... |
let eval_full_function : expression option ref = ref None |
let template_string : expression option ref = ref None |
let last_global_type : Types . type_expr option ref = ref None |
let newmapper argv = { default with expr = ( fun mapper expr -> match expr with | { exp_attributes = [ { attr_name = { txt = " interpret " } ; attr_payload = payload } ] ; exp_type ; exp_desc } -> print_endline " Found a [ @ interpret ] annotation \ n " ; let tinyocaml... |
let ( ) = Tast_mapper . register " tppx_interpret " newmapper |
try printf " d / i positive \ n " ; %! test ( sprintf " % d /% i " 42 43 = " 42 / 43 " ) ; test ( sprintf " %- 4d /%- 5i " 42 43 = " 42 / 43 " ) ; test ( sprintf " % 04d /% 05i " 42 43 = " 0042 / 00043 " ) ; test ( sprintf " %+ d /%+ i... |
type traced_function = { path : Path . t ; closure : Obj . t ; actual_code : codeptr ; instrumented_fun : codeptr -> Obj . t -> Obj . t -> Obj . t } |
let traced_functions = ref ( [ ] : traced_function list ) |
let is_traced clos = let rec is_traced = function [ ] -> None | tf :: rem -> if tf . closure == clos then Some tf . path else is_traced rem in is_traced ! traced_functions |
let get_code_pointer cls = Obj . field cls 0 |
let set_code_pointer cls ptr = Obj . set_field cls 0 ptr |
let invoke_traced_function codeptr env arg = Meta . invoke_traced_function codeptr env arg |
let print_label ppf l = if l <> Asttypes . Nolabel then fprintf ppf " % s " : ( Printtyp . string_of_label l ) |
let rec instrument_result env name ppf clos_typ = match ( Ctype . repr ( Ctype . expand_head env clos_typ ) ) . desc with | Tarrow ( l , t1 , t2 , _ ) -> let starred_name = match name with | Lident s -> Lident ( s ^ " " ) * | Ldot ( lid , s ) -> Ldot ( lid , s ^ " ... |
let instrument_closure env name ppf clos_typ = match ( Ctype . repr ( Ctype . expand_head env clos_typ ) ) . desc with | Tarrow ( l , t1 , t2 , _ ) -> let trace_res = instrument_result env name ppf t2 in ( fun actual_code closure arg -> if not ! may_trace then begin try invoke_traced_fu... |
let rec find_traced_closure clos = function | [ ] -> fatal_error " Trace . find_traced_closure " | f :: rem -> if f . closure == clos then f else find_traced_closure clos rem |
let print_trace clos arg = let f = find_traced_closure clos ! traced_functions in f . instrumented_fun f . actual_code clos arg |
module S = Preface . List . Monoid ( String ) |
module D = Preface . Traced . Over ( S ) |
let dependencies_of = function | " preface_make " -> [ " preface_specs " ] | " preface_specs " -> [ " preface_core " ] | " preface_stdlib " -> [ " preface_make " ; " preface_specs " ; " preface_core " ] | " preface " -> [ " preface_stdlib " ] | _ -... |
let f = Preface . List . Foldable . fold_map ( module S ) dependencies_of |
let direct_deps = D . traced f |
let deps subject = let open D in trace subject ( direct_deps =>> traces Fun . id ) |> List . sort_uniq String . compare ; ; |
let deps_for_make ( ) = let open Alcotest in let expected = [ " preface_core " ; " preface_specs " ] and computed = deps [ " preface_make " ] in check ( list string ) " Should be equal " expected computed ; ; |
let deps_for_stdlib ( ) = let open Alcotest in let expected = [ " preface_core " ; " preface_make " ; " preface_specs " ] and computed = deps [ " preface_stdlib " ] in check ( list string ) " Should be equal " expected computed ; ; |
let deps_for_specs ( ) = let open Alcotest in let expected = [ " preface_core " ] and computed = deps [ " preface_specs " ] in check ( list string ) " Should be equal " expected computed ; ; |
let deps_for_preface ( ) = let open Alcotest in let expected = [ " preface_core " ; " preface_make " ; " preface_specs " ; " preface_stdlib " ] and computed = deps [ " preface " ] in check ( list string ) " Should be equal " expected computed ; ; |
let cases = let open Alcotest in [ ( " Dependencies computing using Traced Comonad " , [ test_case " Deps for preface_make " ` Quick deps_for_make ; test_case " Deps for preface_stdlib " ` Quick deps_for_stdlib ; test_case " Deps for preface_specs " ` Quick deps_for_specs ; test_cas... |
module type S = Traced_sigs . Trace . S |
module type EXTENDED = sig include S val pp : ( Format . formatter -> ' err -> unit ) -> Format . formatter -> ' err trace -> unit val pp_top : ( Format . formatter -> ' err -> unit ) -> Format . formatter -> ' err trace -> unit val fold : ( ' a -> ' error -> ' a ) -> ... |
module SingletonR : EXTENDED = struct type ' error trace = ' error let make e = e let cons e _ = e let cons_list e _ = e let conp e _ = e let conp_list e _ = e let pp pp_error fmt e = pp_error fmt e let pp_top pp_error fmt e = pp_error fmt e let fold f acc e = f acc e open Bare_structs . Monad let ... |
module SingletonL : EXTENDED = struct type ' error trace = ' error let make e = e let cons e _ = e let cons_list e _ = e let conp _ e = e let rec conp_list e = function [ ] -> e | e :: es -> conp_list e es let pp pp_error fmt e = pp_error fmt e let pp_top pp_error fmt e = pp_error fmt e let fol... |
module SingletonND : EXTENDED = struct let prng = Random . State . make_self_init ( ) let either a b = if Random . State . bool prng then a else b let rec any e = function | [ ] -> e | x :: xs -> if Random . State . bool prng then e else any x xs type ' error trace = ' error let make ... |
module Flat : EXTENDED = struct type ' error trace = ' error list let make e = [ e ] let cons e t = e :: t let cons_list e es = e :: es let conp el er = el @ er let conp_list e es = Stdlib . List . flatten ( e :: es ) let pp pp_error fmt t = Format . pp_print_list ~ pp_sep : Format . ... |
module Full : EXTENDED = struct type ' a tree = | Par of ' a tree list | Seq of ' a * ' a tree | Singl of ' a type ' error trace = ' error tree let make e = Singl e let cons e t = Seq ( e , t ) let cons_list e es = match List . rev es with | [ ] -> Singl e | [ ee ] -> Seq ( ... |
module Strs = Set . Make ( String ) |
let tracing = ConfigProfile . profile = " trace " |
let current_loc = ref locUnknown |
let next_loc = ref locUnknown |
let trace_sys = ref Strs . empty |
let activated = ref Strs . empty |
let active_dep = Hashtbl . create 9 |
let tracevars = ref ( [ ] : string list ) |
let tracelocs = ref ( [ ] : int list ) |
let addsystem sys = trace_sys := Strs . add sys ! trace_sys |
let activate ( sys : string ) ( subsys : string list ) : unit = let subs = List . fold_right Strs . add subsys ( Strs . add sys Strs . empty ) in activated := Strs . union ! activated subs ; Hashtbl . add active_dep sys subs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.