text stringlengths 0 601k |
|---|
let _to_type_exprs pathfix tys = match ( to_type_expr pathfix ( Tuple tys ) ) . desc with | Ttuple tys -> tys | _ -> assert false |
let pathfix_for_printing opened p = let open Path in match p with | Pdot ( p , s , _ ) when opened = Some p && mem s Xpredef . predefined_types -> p | _ -> let rec fix = function | Pdot ( Pident id , s , _n ) when Ident . name id = " { predef } " -> Pident ( Ident . create s ) | Pdot ( p , s , _n ) when opened = Some p... |
let format_via_type_expr ppf ty = let ty = to_type_expr ~ anon_parameter_as_constr : true Spath . to_path ty in Type_expr . format ppf ty |
let to_string_via_type_expr = Format . to_string format_via_type_expr |
module Datatypes = Hashcons . Make ( struct type t = datatype let equal dt1 dt2 = dt1 . dt_path == dt2 . dt_path let hash { dt_path = p } = Hashtbl . hash p let name = " datatype " end ) |
let rec_hcons_datatype { dt_path = p ; dt_aliases = r } = Datatypes . non_rec_hcons { dt_path = Spath . rec_hcons p ; dt_aliases = r } |
module HashedType = struct type t = Stype_core . t let hash = Hashtbl . hash let name = " Stype . t " let forall ts1 ts2 f = if length ts1 <> length ts2 then false else for_all2 f ts1 ts2 let option topt1 topt2 f = match topt1 , topt2 with | None , None -> true | Some t1 , Some t2 -> f t1 t2 | _ -> false let equal t1 t... |
let rec_hcons ty0 = let nodes = ref [ ] in let rec rec_hcons ty = nodes +::= ty ; match ty with | Link { contents = ` Stub } -> assert false | Link { contents = ` Linked ty ' } -> if memq ty ' ! nodes then ty else rec_hcons ty ' | Nil -> ty | VariantClosed _ -> H . non_rec_hcons ty | Any -> ty | VarNamed ( n , s ) -> l... |
module M = struct include Hashtbl . Make ( Stype_hcons . HashedType ) let to_list t = let r = ref [ ] in iter ( fun k v -> r +::= ( k , v ) ) t ; ! r end |
let build items = let tbl = M . create 1023 in Array . iter ( fun i -> match Item . type_of_item i with | None -> ( ) | Some ty -> try let ( count , p ) = M . find tbl ty in M . replace tbl ty ( count + 1 , p ) with | Not_found -> M . add tbl ty ( 1 , ref ( - 1 ) ) ) items ; !!% " Type pool . " ; :@ !!% " % d different... |
let wrap_kind wrap = function | Class -> Class | ClassType -> ClassType | ClassField ( vf , ty ) -> ClassField ( vf , wrap ty ) | Constr ty -> Constr ( wrap ty ) | Exception ty -> Exception ( wrap ty ) | Field ty -> Field ( wrap ty ) | Method ( pv , vf , ty ) -> Method ( pv , vf , wrap ty ) | ModType -> ModType | Modul... |
let wrap_item wrap i = { i with kind = wrap_kind wrap i . kind } |
let poolize items = let a , f = build items in let wrap ty = match f ty with | None -> Not_pooled ty | Some n -> Pooled n in Array . map ( wrap_item wrap ) items , a |
let unpool_item a i = let wrap = function | Not_pooled ty -> ty | Pooled i -> Array . unsafe_get a i in wrap_item wrap i |
type label = string with conv ( ocaml ) |
type o = | Otyp_alias of o * string | Otyp_any | Otyp_arrow of label * o * o | Otyp_class of bool * Spath . t * o list | Otyp_constr of Spath . t * o list | Otyp_link of o | Otyp_module of Spath . t * Spath . t list * o list | Otyp_object of ( string * o ) list * bool option | Otyp_poly of string list * o | Otyp_stuff ... |
let rec repr = function | Link { contents = ` Linked ty } -> repr ty | Link { contents = ` Stub } -> assert false | ty -> ty |
let static_row row = match row . xrow_fields with | ` Exact _ -> true | ` Open _ -> false | ` Closed ( tags , present ) -> List . length tags = List . length present |
let row_more row = row . xrow_more |
let proxy ty = match ty with | Variant row when not ( static_row row ) -> row_more row | Object ( None , None ) -> assert false | Object ( None , Some _ ) -> ty | Object ( Some ( _ , ` Open t ) , _named ) -> t | _ -> ty |
let aliasable ty = match ty with | Var _ | VarNamed _ | Univar _ | UnivarNamed _ | Poly _ -> false | Constr ( _p , _ ) -> true | _ -> true |
let rec iter_row f row = begin match row . xrow_fields with | ` Exact tags | ` Open tags -> flip List . iter tags ( function | ` Tag ( _ , topt ) -> Option . iter f topt | ` Inherit t -> f t ) | ` Closed ( tags , _present ) -> flip List . iter tags ( function | ` Tag ( _ , _ , ts ) -> List . iter f ts | ` Inherit t -> ... |
let opened_object ty = match ty with | Object ( Some ( _ , ` Open _t ) , _ ) -> true | _ -> false |
let names = ref ( [ ] : ( t * string ) list ) |
let name_counter = ref 0 |
let named_vars = ref ( [ ] : string list ) |
let reset_names ( ) = names := [ ] ; name_counter := 0 ; named_vars := [ ] |
let add_named_var ty = match ty with VarNamed ( _ , name ) | UnivarNamed ( _ , name ) -> if List . mem name ! named_vars then ( ) else named_vars := name :: ! named_vars | _ -> ( ) |
let visited_objects = ref ( [ ] : t list ) |
let aliased = ref ( [ ] : t list ) |
let delayed = ref ( [ ] : t list ) |
let add_delayed t = if not ( List . memq t ! delayed ) then delayed := t :: ! delayed |
let is_aliased ty = List . memq ( proxy ty ) ! aliased |
let add_alias ty = let px = proxy ty in if not ( is_aliased px ) then begin aliased := px :: ! aliased ; add_named_var px end |
let namable_row row = row . xrow_name <> None && match row . xrow_fields with | ` Exact _ | ` Open _ -> true | ` Closed ( tags , _present ) -> List . for_all ( function | ` Inherit _ -> true | ` Tag ( _ , false , [ _ ] ) | ` Tag ( _ , true , [ ] ) -> true | _ -> false ) tags |
let rec mark_loops_rec visited ty = let ty = repr ty in let px = proxy ty in if List . memq px visited && aliasable ty then add_alias px else let visited = px :: visited in match ty with | Attr ( _ , ty ) -> mark_loops_rec visited ty | Alias ( ty , _s ) -> mark_loops_rec visited ty | Any -> ( ) | Var _ | VarNamed _ -> ... |
let mark_loops ty = mark_loops_rec [ ] ty |
let reset_loop_marks ( ) = visited_objects := [ ] ; aliased := [ ] ; delayed := [ ] |
let reset ( ) = reset_names ( ) ; reset_loop_marks ( ) |
let reset_and_mark_loops ty = reset ( ) ; mark_loops ty |
let rec new_name ( ) = let name = if ! name_counter < 26 then String . make 1 ( Char . chr ( 97 + ! name_counter ) ) else String . make 1 ( Char . chr ( 97 + ! name_counter mod 26 ) ) ^ string_of_int ( ! name_counter / 26 ) in incr name_counter ; if List . mem name ! named_vars || List . exists ( fun ( _ , name ' ) -> ... |
let remove_names tyl = names := List . filter ( fun ( ty , _ ) -> not ( List . memq ty tyl ) ) ! names |
let name_of_type t = try List . assq t ! names with Not_found -> let name = match t with | VarNamed ( _ , name ) | UnivarNamed ( _ , name ) -> let current_name = ref name in let i = ref 0 in while List . exists ( fun ( _ , name ' ) -> ! current_name = name ' ) ! names do current_name := name ^ ( string_of_int ! i ) ; i... |
let check_name_of_type t = ignore ( name_of_type t ) |
let tree_of_path ( spath : Spath . t ) = spath |
let rec tree_of_typexp sch ty = let ty = repr ty in let px = proxy ty in if List . mem_assq px ! names && not ( List . memq px ! delayed ) then let mark = is_non_gen sch ty in Otyp_var ( mark , name_of_type px ) else let pr_typ ( ) = match ty with | Attr ( r , ( Var _ | Univar _ | VarNamed _ | UnivarNamed _ as ty ) ) -... |
let ( ^-> ) = let mbinop assoc lev sep = binop assoc lev ~ op ( : space ++ string sep ++ string " " ) in mbinop Right 0 . 9 " " -> |
let ty_app = binop Left 100 . 0 ~ op : space |
let tree spath o = let rec f o = let list ' first sep pprs end_ = reset & match pprs with | [ ] -> first ++ end_ | _ -> list 1 . 0 cut ( List . mapi ( fun n ppr -> ( if n = 0 then first else sep ) ++ level 0 . 0 ppr ) pprs ) ++ end_ in match o with | Otyp_attr ( _attr , o ) -> attr ` Bold & f o | Otyp_alias ( o , n ) -... |
let print spath xty = reset_and_mark_loops xty ; let o = tree_of_typexp true xty in tree spath o |
let format_gen spath ppf xty = reset_and_mark_loops xty ; let o = tree_of_typexp true xty in Printer . format ( tree spath ) ppf o |
let format = format_gen Spath . print |
let to_string = Format . to_string format |
let show t = Format . to_string ( format_gen ( fun t -> Spath . print ~ packages ` : Exact ~ predef : true t ) ) t |
let read str = Util . ParseError . catch ( fun lexbuf -> let ty = XParser . poly_type Lexer . token lexbuf in ` Ok ( Stype_conv . of_core_type ty ) ) ( Lexing . from_string str ) |
let cannot_read = function | Arrow ( " " , _ , Poly _ ) -> true | VarNamed ( _ , " _ " ) -> true | _ -> false |
let sanitize = <: s <\ s +/ / g >> *> <: s <\ s ; ; +// g >> |
let read_show_read s = match read s with | ` Error e -> !!% " read : % S : % s . " @ s e ; assert false | ` Ok ty -> let s ' = show ty in let sfix = sanitize s in let s ' fix = sanitize s ' in if sfix <> s ' fix then begin !!% " read => show . :@ Input =% S . @ Output =% S . @ FixI =% S . @ FixO =% S . @ Parsed =% a . ... |
let read_show_read_show ty = read_show_read & show ty |
let test_read_show = read_show_read *< show |
let test_printer_compatibility ty = let s2 = Format . to_string ( Stype . format_gen ( Spath . print ~ predef : true ) ) ty in let s2 ' = sanitize s2 in try let s1 = Stype . to_string_via_type_expr ty in let s1 ' = sanitize s1 in if s1 ' <> s2 ' then begin !!% " test_printer_compatibility . :@ ORG : % S . @ XTYPE : % S... |
let bad_guys = [ ] |
let test items n = let item = items . ( n ) in let p = Spath . show item . Item . path in if List . exists ( fun r -> ( p =~ r ) <> None ) bad_guys then !!% " Skipping % s . " @ p else try let tys = Item . types_of_kind item . Item . kind in iter ( fun ty -> if not & Stype_print . cannot_read ty then read_show_read_sho... |
let test items = let path = " tests / types . txt " in if File . Test . _e path then File . iter_lines_exn path ( fun l -> test_printer_compatibility & Result . from_Ok & Stype . read l ; read_show_read l ) ; !!% " tests / types . txt done . " ; @ let ixs = Array . ( init ( length items ) id ) in let size_of_item i = f... |
let editor_full , set_editor_full = React . S . create ( false : bool ) |
let filename , set_filename = React . S . create ( None : string option ) |
let move_cursor , set_move_cursor = React . E . create ( ) |
let file_label = Tyxml_js . R . Html . txt ( React . S . map ( Option_util . unsome " " ) State_file . current_filename ) |
let toggle_button = Html . a ~ a [ : Html . a_id toggle_button_id ; Html . Unsafe . string_attrib " role " " button " ; Html . a_class [ " btn " ; " btn - default " ; " pull - right " ] ] [ Html . cdata " toggle " ] |
let panel_heading = let menu_editor_file_content : [ > Html_types . div ] Tyxml_js . Html5 . elt = Html . div ~ a [ : Html . a_class [ " btn - group " ] ; Html . Unsafe . string_attrib " role " " group " ; ] Menu_editor_file . content in let buttons = menu_editor_file_content :: [ toggle_button ] in [ % html { |< div c... |
let content ( ) = let textarea = Html . textarea ~ a [ : Html . a_id codemirror_id ] ( Html . txt " " ) in Html . div ~ a [ : Html . a_class [ " flex - content " ; " panel " ; " panel - default " ] ] [ Html . div ~ a [ : Html . a_class [ " panel - heading " ] ] [ panel_heading ] ; Html . div ~ a [ : Tyxml_js . R . Html... |
let error_lint errors : Codemirror . lint Js . t Js . js_array Js . t = let position p = new % js Codemirror . position ( p . Locality . line - 1 ) ( p . Locality . chr ) in let hydrate ( error : Api_types_j . message ) : lint Js . t option = match error . Result_util . range with | None -> None | Some range -> match R... |
let setup_lint _ _ _ = error_lint ( React . S . value State_error . errors ) |
let jump_to_line ( codemirror : codemirror Js . t ) ( line : int ) : unit = let position : position Js . t = new % js Codemirror . position line 0 in let mode : Js . js_string Js . t Js . opt = Js . some ( Js . string " local " ) in let coords : Codemirror . dimension Js . t = codemirror ## charCoords position mode in ... |
let onload ( ) : unit = let ( ) = Menu_editor_file . onload ( ) in let lint_config = Codemirror . create_lint_configuration ( ) in let ( ) = lint_config . ## getAnnotations := setup_lint in let ( ) = lint_config . ## lintOnChange := Js . _false in let configuration = Codemirror . default_configuration in let gutter_opt... |
let onresize ( ) = ( ) |
let img = [ docker_image ~ account " : pveber " ~ name " : subread " ~ tag " : 1 . 6 . 3 " ( ) ] inherit tsv method header : [ ` no ] method f1 : string method f2 : string method f3 : int method f4 : int method f5 : [ ` Plus | ` Minus ] method f6 : int method f7 : int end |
let strandness_token = function | ` Unstranded -> int 0 | ` Stranded -> int 1 | ` Reversely_stranded -> int 2 |
let featureCounts ? feature_type ? attribute_type ? strandness ? chrAliases ? requireBothEndsMapped ? countChimericFragments ? minFragLength ? maxFragLength ? useMetaFeatures ? allowMultiOverlap ? fraction ? q ? nthreads gff mapped_reads = Workflow . shell ~ descr " : featureCounts " ~ img ~ np ( : Option . value ~ def... |
let featureCounts_tsv o = Workflow . select o [ " counts . tsv " ] |
let featureCounts_htseq_tsv o = Workflow . shell ~ descr " : featureCounts_htseq_tsv " [ pipe [ cmd " sed " [ quote ~ using ' ' ' :\ ( string " 1 , 2d " ) ; dep ( featureCounts_tsv o ) ] ; cmd " awk " ~ stdout : dest [ quote ~ using ' ' ' :\ ( string " { print $ 1 , $ 7 } " ) ; string " OFS ' =\ t ' " ; ] ] ] |
let featureCounts_summary o = Workflow . select o [ " counts . tsv . summary " ] |
type ' a t = { topic : string ; id : Id . t ; mutable closed : bool ; validator : ' a Envelope . Incoming . t -> Validation_callback . t -> unit Deferred . t ; encode : ' a -> string ; on_decode_failure : [ ` Ignore | ` Call of string Envelope . Incoming . t -> Error . t -> unit ] ; decode : string -> ' a Or_error . t ... |
type e = E : ' a t -> e |
let id { id ; _ } = id |
let topic { topic ; _ } = topic |
let subscribe ~ helper ~ topic ~ encode ~ decode ~ on_decode_failure ~ validator = let open Deferred . Or_error . Let_syntax in let subscription_id = Id . create ( ) in let % map _ = Libp2p_helper . do_rpc helper ( module Libp2p_ipc . Rpcs . Subscribe ) Subscribe ( Libp2p_ipc . Rpcs . Subscribe . create_request ~ topic... |
let unsubscribe ~ helper sub = let open Deferred . Or_error . Let_syntax in if not sub . closed then let % map _ = Libp2p_helper . do_rpc helper ( module Libp2p_ipc . Rpcs . Unsubscribe ) Unsubscribe ( Libp2p_ipc . Rpcs . Unsubscribe . create_request ~ subscription_id : sub . id ) id in sub . closed <- true else Deferr... |
let handle_and_validate sub ~ validation_expiration ( ~ sender : Peer . t ) t ~ data : raw_data = let open Libp2p_ipc . Reader . ValidationResult in let wrap_message data = if Unix . Inet_addr . equal sender . host ( Unix . Inet_addr . of_string " 127 . 0 . 0 . 1 ) " && Int . equal sender . libp2p_port 0 then Envelope ... |
let publish_raw ~ logger ~ helper ~ topic data = match % map Libp2p_helper . do_rpc helper ( module Libp2p_ipc . Rpcs . Publish ) Publish ( Libp2p_ipc . Rpcs . Publish . create_request ~ topic ~ data ) data with | Ok _ -> ( ) | Error e -> [ % log ' error logger ] logger " error while publishing message on $ topic : $ e... |
let publish ~ logger ~ helper { topic ; encode ; _ } message = publish_raw ~ logger ~ helper ~ topic ( encode message ) message |
module Subscriptions : sig type ' a t val empty : ' a t val add_node : string -> ' a -> ' a t -> ' a t val remove_node : string -> ' a -> ' a t -> ' a t val query : string -> ' a t -> ' a list val length : ' a t -> int val tests : OUnit . test list type ' a t = | E | NV of string * ( string , ' a t ) Hashtbl . t | V of... |
type type_replacement = | Path of Path . t | Type_function of { params : type_expr list ; body : type_expr } |
type t = { types : type_replacement Path . Map . t ; modules : Path . t Path . Map . t ; modtypes : module_type Ident . Map . t ; for_saving : bool ; } |
let identity = { types = Path . Map . empty ; modules = Path . Map . empty ; modtypes = Ident . Map . empty ; for_saving = false ; } |
let add_type_path id p s = { s with types = Path . Map . add id ( Path p ) s . types } |
let add_type id p s = add_type_path ( Pident id ) p s |
let add_type_function id ~ params ~ body s = { s with types = Path . Map . add id ( Type_function { params ; body } ) s . types } |
let add_module_path id p s = { s with modules = Path . Map . add id p s . modules } |
let add_module id p s = add_module_path ( Pident id ) p s |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.