text stringlengths 0 601k |
|---|
module G = struct let console = Jv . get Jv . global " console " let document = El . global_document let navigator = Jv . get Jv . global " navigator " let performance = Jv . get Jv . global " performance " let window = Jv . get Jv . global " window " let is_secure_context = Jv . Bool . get Jv . global " isSecureContex... |
module Matrix4 = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let is_2d m = Jv . Bool . get m " is2D " let is_identity m = Jv . Bool . get m " isIdentity " let inverse m = Jv . call m " inverse " [ ] || let multiply m m ' = Jv . call m " multiply " [ | m ' ] | let m11 m = Jv . Float . get m "... |
module Vec4 = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let v4 = Jv . get Jv . global " DOMPointReadOnly " let v ~ x ~ y ~ z ~ w = Jv . new ' v4 Jv . [ | of_float x ; of_float y ; of_float z ; of_float w ; ] | let tr m v = Jv . call v " matrixTransform " [ | Matrix4 . to_jv m ] | let to_js... |
module Canvas = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let create ? d ? at ( ? w = 0 ) ( ? h = 0 ) cs = let c = El . to_jv @@ El . canvas ? d ? at cs in Jv . Int . set c " width " w ; Jv . Int . set c " height " h ; c let of_el e = if El . has_tag_name El . Name . canvas e then ( El . t... |
module C2d = struct module Fill_rule = struct type t = Jstr . t let nonzero = Jstr . v " nonzero " let evenodd = Jstr . v " evenodd " end module Image_smoothing_quality = struct type t = Jstr . t let low = Jstr . v " low " let medium = Jstr . v " medium " let high = Jstr . v " high " end module Line_cap = struct type t... |
module Gl = struct module Attrs = struct module Power_preference = struct type t = Jstr . t let default = Jstr . v " default " let high_performance = Jstr . v " high - performance " let low_power = Jstr . v " low - power " end type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let v ? alpha ? depth ? sten... |
module Clipboard = struct module Item = struct module Presentation_style = struct type t = Jstr . t let unspecified = Jstr . v " unspecified " let inline = Jstr . v " inline " let attachment = Jstr . v " attachement " end type opts = Jv . t let opts ? presentation_style ( ) = let o = Jv . obj [ ] || in Jv . Jstr . set_... |
module Form = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let of_el e = if El . has_tag_name El . Name . form e then El . to_jv e else let exp = Jstr . v " Expected form element but found : " in Jv . throw ( Jstr . append exp ( El . tag_name e ) ) let to_el e = El . of_jv e let name f = Jv .... |
module Fetch = struct module Body = struct type init = Jv . t let of_jstr = Jv . of_jstr let of_uri_params = Uri . Params . to_jv let of_form_data = Form . Data . to_jv let of_blob = Blob . to_jv let of_array_buffer = Tarray . Buffer . to_jv type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let body_used... |
module Geolocation = struct module Error = struct type code = int let permission_denied = 1 let position_unavailable = 2 let timeout = 3 type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let code e = Jv . Int . get e " code " let message e = Jv . Jstr . get e " message " end module Pos = struct type t = ... |
module Media = struct module Prop = struct module Bool = struct module Constraint = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let v ? exact ? ideal ( ) = let o = Jv . obj [ ] || in Jv . Bool . set_if_some o " exact " exact ; Jv . Bool . set_if_some o " ideal " ideal ; o end end module Int ... |
module Message = struct type transfer = Jv . t let transfer = Jv . repr type opts = Jv . t let opts ? target_origin ? transfer ( ) = let o = Jv . obj [ ] || in Jv . Jstr . set_if_some o " targetOrigin " target_origin ; Jv . set_if_some o " transfer " ( Option . map Jv . of_jv_list transfer ) ; o module Port = struct ty... |
module Notification = struct module Permission = struct type t = Jstr . t let default = Jstr . v " default " let denied = Jstr . v " denied " let granted = Jstr . v " granted " end let notification = Jv . get Jv . global " Notification " let permission ( ) = Jv . Jstr . get notification " permission " let request_permi... |
module Storage = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let local w = Jv . get ( Window . to_jv w ) " localStorage " let session w = Jv . get ( Window . to_jv w ) " sessionStorage " let length s = Jv . Int . get s " length " let key s i = Jv . to_option Jv . to_jstr @@ Jv . call s " key... |
module Websocket = struct module Binary_type = struct type t = Jstr . t let blob = Jstr . v " blob " let arraybuffer = Jstr . v " arraybuffer " end module Ready_state = struct type t = int let connecting = 0 let open ' = 1 let closing = 2 let closed = 3 end type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t... |
module Futr = struct let to_event f = let e , send_e = E . create ( ) in let send_e v = ignore ( G . set_timeout ~ ms : 0 @@ fun ( ) -> send_e v ) in Fut . await f send_e ; e let of_event e = let fut , set_fut = Fut . create ( ) in let logr = ref None in let set_fut v = ignore @@ G . set_timeout ~ ms : 0 @@ fun ( ) -> ... |
module Consoler = struct let tick _ = Console . [ Jstr . v " tick " ] let log_value ( ? l = Console . debug ) ( ? v = fun v -> Console . [ v ] ) id x = l Console . ( Jstr . ( v id + v " " ) : :: ( v x ) ) ; x module E = struct let log ( ? obs = false ) ? l ? v id e = match obs with | false -> E . map ( log_value ? l ? ... |
module Evr = struct let instruct ( ? propagate = true ) ( ? default = true ) e = ( if default then ( ) else Ev . prevent_default e ) ; if propagate then ( ) else Ev . stop_propagation e let endless_listen ( ? capture = false ) ? propagate ? default t type ' f = let opts = match capture with | false -> None | true -> So... |
module Elr = struct let xxx_funs xxx e : ( unit -> unit ) list = Obj . magic @@ Jv . get e xxx let add_xxx_fun xxx f e = let fs = Jv . get e xxx in let fs = if Jv . is_undefined fs then [ f ] else ( f :: Obj . magic fs ) in Jv . set e xxx ( Jv . repr fs ) let add_add_fun = add_xxx_fun " brr_add " let add_rem_fun = add_... |
module Key = struct type code = int type t = [ ` Alt of [ ` Left | ` Right ] | ` Arrow of [ ` Up | ` Down | ` Left | ` Right ] | ` Ascii of Char . t | ` Backspace | ` Ctrl of [ ` Left | ` Right ] | ` End | ` Enter | ` Escape | ` Func of int | ` Home | ` Insert | ` Key of code | ` Meta of [ ` Left | ` Right ] | ` Page o... |
module Mouse = struct let warn_but ( ) = Console . ( warn [ Jstr . v " unexpected e . which " ] ) let pt x y = ( x , y ) type ' a events = { t : Ev . target ; normalize : bool ; pt : float -> float -> ' a ; mutable last_pos : float * float ; mutable unlisten : ( unit -> unit ) list ; pos : ' a signal ; set_pos : ' a S ... |
module Windowr = struct let in_fullscreen ( ) = Option . is_some ( Document . fullscreen_element G . document ) let is_fullscreen = let is_fullscreen , set_fullscreen = S . create ( in_fullscreen ( ) ) in let change _e = set_fullscreen ( in_fullscreen ( ) ) in Ev . listen Ev . fullscreenchange change ( Document . as_ta... |
module Time = struct type span = float let tick_now ( ) = Performance . now_ms G . performance . / 1000 . let start = tick_now ( ) let elapsed ( ) = tick_now ( ) . - start type counter = span let counter ( ) = tick_now ( ) let counter_value c = tick_now ( ) . - c let tick span = let e , send_e = E . create ( ) in let c... |
module Human = struct let noticed = 0 . 1 let interrupted = 1 . let left = 10 . let rec feel_action feel set_feel ( ) = let new_feel , delay = match S . value feel with | ` Interacting -> ` Interrupted , left . - interrupted | ` Interrupted -> ` Left , 0 . | ` Left -> assert false in set_feel new_feel ; if delay = 0 . ... |
module Ui = struct let ui_active = Jstr . v " ui - active " let ui_button = Jstr . v " ui - button " let ui_button_selector = Jstr . v " ui - button - selector " let ui_dir_align_center = Jstr . v " ui - dir - align - center " let ui_dir_align_distribute = Jstr . v " ui - dir - align - distribute " let ui_dir_align_end... |
let json = Jv . get Jv . global " JSON " = " caml_int64_create_lo_mi_hi " |
let int64_to_jv v = Jv . of_jv_array Jv . [ | of_int 255 ; get v " lo " ; get v " mi " ; get v " hi " ] | |
let int64_of_jv v = int64_lo_mi_hi ( Jv . to_int ( Jv . Jarray . get v 1 ) ) ( Jv . to_int ( Jv . Jarray . get v 2 ) ) ( Jv . to_int ( Jv . Jarray . get v 3 ) ) |
let encode_ocaml_value v = let string = Jv . get ( Jv . repr " " ) " constructor " in let int64 = Jv . get ( Jv . repr 1L ) " constructor " in let replacer _key v = if Jv . instanceof v ~ cons : string then string_to_jsbytes v else if Jv . instanceof v ~ cons : int64 then int64_to_jv v else v in Jv . to_jstr ( Jv . cal... |
let decode_unsafe_ocaml_value s = let jsarray = Jv . get ( Jv . repr ( Jv . Jarray . create 0 ) ) " constructor " in let reviver _key v = if Jstr . equal ( Jv . typeof v ) ( Jstr . v " string " ) then string_of_jsbytes v else if Jv . instanceof v ~ cons : jsarray && Jv . Jarray . length v == 4 && Jv . to_int ( Jv . Jar... |
module Store = struct type scope = [ ` Session | ` Persist ] let scope_store = function | ` Session -> Storage . session G . window | ` Persist -> Storage . local G . window type ' a key = Jstr . t let key_prefix = Jstr . v " k " let key = let id = ref ( - 1 ) in fun ? ns ( ) -> id := ! id + 1 ; let id = Jstr . of_int ... |
eval : Jstr . t -> Jstr . t ; use : Jstr . t -> Jstr . t . t ; } The type [ t ] is how we interact with it after we found , either in the current global context or in another one in case of the web extension . ) * |
type t = { version : int ; ocaml_version : Jstr . t ; jsoo_version : Jstr . t ; eval : Jstr . t -> Brr . Json . t Fut . or_error ; use : Jstr . t -> Brr . Json . t Fut . or_error ; } |
let version p = p . version |
let ocaml_version p = p . ocaml_version |
let jsoo_version p = p . jsoo_version |
let eval p = p . eval |
let use p = p . use |
let err_version version = Jstr . ( v " Page poke version mismatch . Should be v " + of_int poke_version + v " but found v " + of_int version + v " . \ n \ nTry to upgrade the OCaml console web extension to the \ latest version . " ) |
let err_miss_prop p = Jstr . ( v " Page poke property ocaml_poke . " + v p + v " is missing . " ) |
let find ( ) = match Jv . find Jv . global " ocaml_poke " with try let get p o = match Jv . find o p with | None -> Jv . throw ( err_miss_prop p ) | Some v -> v in let version = Jv . to_int ( get " version " o ) in if version > poke_version then Jv . throw ( err_version version ) else let ocaml_version = Jv . to_jstr (... |
let find_eval ' d ~ eval : js_eval = let open Fut . Result_syntax in let * undef = js_eval ( Jstr . v " globalThis . ocaml_poke == undefined " ) in if Jv . to_bool undef then Fut . ok None else let get to_t prop = let * v = js_eval Jstr . ( v " ocaml_poke . " + v prop ) in match Jv . to_option to_t v with | None -> Fut... |
module Store = struct type t = { get : Jstr . t -> Jstr . t option Fut . or_error ; set : Jstr . t -> Jstr . t -> unit Fut . or_error } let create ~ get ~ set = { get ; set } let get s = s . get let set s = s . set let key_prefix = Jstr . v " ocaml - repl " - let page ( ? key_prefix = key_prefix ) store = let key k = J... |
module History = struct type t = { prev : Jstr . t list ; focus : Jstr . t ; next : Jstr . t list ; } let v ~ prev = let add acc e = let e = Jstr . trim e in if Jstr . is_empty e then acc else e :: acc in let focus = Jstr . empty in { prev = List . rev ( List . fold_left add [ ] prev ) ; focus ; next = [ ] } let empty ... |
module Highlight = struct let el e = match Jv . find Jv . global " hljs " with | None -> e | Some hljs -> ignore @@ Jv . call hljs " highlightBlock " [ | El . to_jv e ] ; | e end |
module Text_input : sig type t val create : ? lang : Jstr . t -> prompt : El . t -> unit -> t val el : t -> El . t val input : t -> El . t val hide : t -> unit val show : t -> unit val set_has_focus : bool -> t -> unit val cursor_pos : t -> int option val set : t -> Jstr . t -> unit val get : t -> Jstr . t val update_i... |
module Spinner = struct type t = { mutable abort : Abort . t option ; el : El . t } let el s = s . el let abort s = match s . abort with | None -> ( ) | Some a -> Abort . abort a ; s . abort <- None let hide s = abort s ; El . set_inline_style El . Style . display ( Jstr . v " none " ) s . el let create ( ) = let el = ... |
type t = { view : El . t ; output : El . t ; spinner : Spinner . t ; input : Text_input . t ; store : Store . t ; mutable h : History . t } |
type output_kind = [ ` Past_input | ` Reply | ` Warning | ` Error | ` Info | ` Announce ] |
let output r ~ kind cs = let at = At . [ class ' ( Jstr . v ( output_kind_to_class kind ) ) ] in let li = El . li ~ at cs in El . append_children r . output [ li ] |
let announce_poke poke = let ocaml = let version = Brr_ocaml_poke . ocaml_version poke in let ocaml = Jstr . append ( Jstr . v " OCaml version " ) version in El . span ~ at : At . [ class ' ( Jstr . v " ocaml " ) ] [ El . txt ocaml ] in let jsoo = let version = Brr_ocaml_poke . jsoo_version poke in let jsoo = match Jst... |
let ocaml_pre s = if Jstr . is_empty s then [ ] else [ Highlight . el ( El . pre ~ at : At . [ class ' ( Jstr . v " ocaml " ) ] [ El . txt s ] ) ] |
let history_sep = Jstr . v " " |
let history_key = Jstr . v " history " |
let history_clear r = r . h <- History . empty ; r . store . set history_key Jstr . empty |
let history_load r = let * h = r . store . get history_key in let history = Option . value ~ default : Jstr . empty h in r . h <- History . of_string ~ sep : history_sep history ; Fut . ok ( ) |
let history_prev r s = match History . prev r . h s with |
let history_next r s = match History . next r . h s with |
let history_save r s = let chop_end_nl s = if Jstr . ends_with ~ suffix ( : Jstr . v " \ n " ) s then Jstr . slice ~ stop ( :- 1 ) s else s in r . h <- History . add r . h ( chop_end_nl s ) ; let h = History . to_string ~ sep : history_sep r . h in ignore @@ Fut . map ( Console . log_if_error ~ use ( ) ) : @@ r . store... |
let history_clear_ui r = let clear = El . button El . [ txt ' " Clear history " ] in let clear_act _ = ignore @@ Fut . map ( Console . log_if_error ~ use ( ) ) : @@ history_clear r in Ev . listen Ev . click clear_act ( El . as_target clear ) ; clear |
let history_keyboard_moves r key = let first_line_end s = match Jstr . find_sub ~ sub : Jstr . nl s with | None -> Jstr . length s | Some i -> i in let last_line_start s = match Jstr . find_last_sub ~ sub : Jstr . nl s with | None -> 0 | Some i when i = Jstr . length s - 1 -> 0 | Some i -> i + 1 in let k = Ev . as_type... |
let prompt ( ) = El . span ~ at : At . [ class ' ( Jstr . v " prompt " ) ] El . [ txt ' " " ] # |
let lock_input r = Text_input . hide r . input ; Spinner . show r . spinner |
let unlock_input r = Spinner . hide r . spinner ; Text_input . show r . input ; Text_input . update_input r . input ; Text_input . set_has_focus true r . input |
let handle_text_input r poke _e = let i = Text_input . get r . input in let enter = Jstr . v " ; ; \ n " and enter_win = Jstr . v " ; ; \ r \ n " in let submit = Jstr . ends_with ~ suffix : enter i || Jstr . ends_with ~ suffix : enter_win i in if not submit then Text_input . update_input r . input else begin history_sa... |
let use_ml_file r poke file = let use = Jstr . ( v " # use " " \ + File . name file + v " " ; ; " ) \ in output r ~ kind ` : Past_input ( prompt ( ) :: ocaml_pre use ) ; let * text = Blob . text ( File . as_blob file ) in let * out = Brr_ocaml_poke . use poke text in let out = Jv . to_jstr out in output r ~ kind ` : Re... |
let use_ml_files r poke files = let rec loop = function | f :: fs -> let * ( ) = use_ml_file r poke f in loop fs | [ ] -> Fut . ok ( ) in let finish result = Console . log_if_error ~ use ( ) : result ; unlock_input r in lock_input r ; ignore @@ Fut . map finish ( loop files ) |
let use_ml_ui r poke = let on_change i = let files = El . Input . files i in El . set_prop El . Prop . value Jstr . empty i ; use_ml_files r poke files in let i = El . input ~ at : At . [ type ' ( Jstr . v " file " ) ] ( ) in let b = El . button [ El . txt ' " # use " " " \…\ ] in El . set_inline_style El . Style . dis... |
let use_ml_on_file_drag_and_drop ? drop_target r poke = let on_drop e = Ev . prevent_default e ; match Ev . Drag . data_transfer ( Ev . as_type e ) with | None -> ( ) | Some dt -> let items = Ev . Data_transfer . ( Item_list . items ( items dt ) ) in let files = List . filter_map Ev . Data_transfer . Item . get_file it... |
let create ( ? store = Store . page ( Storage . local G . window ) ) view = let output = El . ol [ ] in let spinner = Spinner . create ( ) in let input = Text_input . create ~ prompt ( : prompt ( ) ) ( ) in let r = { view ; output ; input ; spinner ; store ; h = History . v ~ prev [ ] : } in El . set_children view [ ou... |
let buttons ( ? buttons = [ ] ) r poke = let panel = El . div ~ at : At . [ class ' ( Jstr . v " buttons " ) ] [ ] in let clear = history_clear_ui r in let use_ml = use_ml_ui r poke in El . set_children panel ( buttons @ [ clear ; use_ml ] ) ; panel |
let setup_poke_io ? drop_target r poke = let input = El . as_target ( Text_input . input r . input ) in Ev . listen Ev . input ( handle_text_input r poke ) input ; Ev . listen Ev . keydown ( history_keyboard_moves r ) input ; use_ml_on_file_drag_and_drop ? drop_target r poke |
let run ? drop_target ? buttons : bs r poke = let buttons = buttons ? buttons : bs r poke in El . append_children r . view [ buttons ] ; setup_poke_io ? drop_target r poke ; output r ~ kind ` : Announce [ announce_poke poke ] ; Text_input . show r . input ; Text_input . set_has_focus true r . input |
let js_to_string o = if Jv . is_null o then " null " else if Jv . is_undefined o then " undefined " else Jv . to_string ( Jv . call o " toString " [ ] ) || |
let pp_jv ppf v = Format . pp_print_string ppf ( js_to_string v ) |
let pp_jstr ppf s = Format . fprintf ppf " [ @ Jstr . v % S ] " @ ( Jstr . to_string s ) |
let pp_jv_error ppf ( e : Jv . Error . t ) = Format . pp_print_string ppf ( js_to_string ( Jv . repr e ) ) |
let stdouts = ref Jstr . empty |
let stdouts_reset ( ) = stdouts := Jstr . empty |
let stdouts_append ~ js_string : d = stdouts := Jstr . append ! stdouts ( Obj . magic d : Jstr . t ) |
let resp = Buffer . create 100 |
let top_init ( ) = Jsoo_runtime . Sys . set_channel_output ' stdout stdouts_append ; Jsoo_runtime . Sys . set_channel_output ' stderr stdouts_append ; Js_of_ocaml_toplevel . JsooTop . initialize ( ) ; let ppf = Format . formatter_of_buffer resp in ignore ( Js_of_ocaml_toplevel . JsooTop . use ppf " # install_printer Br... |
let top_eval phrase = let ppf = Format . formatter_of_buffer resp in stdouts_reset ( ) ; Js_of_ocaml_toplevel . JsooTop . execute true ppf ( Jstr . to_string phrase ) ; let r = Jstr . append ! stdouts ( Jstr . of_string ( Buffer . contents resp ) ) in Buffer . reset resp ; stdouts_reset ( ) ; r |
let top_use phrases = let ppf = Format . formatter_of_buffer resp in stdouts_reset ( ) ; let _bool = Js_of_ocaml_toplevel . JsooTop . use ppf ( Jstr . to_string phrases ) in let r = Jstr . append ! stdouts ( Jstr . of_string ( Buffer . contents resp ) ) in stdouts_reset ( ) ; Buffer . reset resp ; r |
let define ( ) = let ocaml_version = Jstr . of_string Sys . ocaml_version in let jsoo_version = Jstr . of_string Js_of_ocaml . Sys_js . js_of_ocaml_version in let o = Jv . obj [ | " version " , Jv . of_int 0 ; " ocaml_version " , Jv . of_jstr ocaml_version ; " jsoo_version " , Jv . of_jstr jsoo_version ; " init " , Jv ... |
module Audio = struct module Param = struct module Automation_rate = struct type t = Jstr . t let a_rate = Jstr . v " a - rate " let k_rate = Jstr . v " k - rate " end type descriptor = Jv . t let descriptor ? automation_rate ? min_value ? max_value ? default_value n = let o = Jv . obj [ ] || in Jv . set o " name " ( J... |
module Crypto_key = struct module Type = struct type t = Jstr . t let public = Jstr . v " public " let private ' = Jstr . v " private " let secret = Jstr . v " secret " end module Usage = struct type t = Jstr . t let encrypt = Jstr . v " encrypt " let decrypt = Jstr . v " decrypt " let sign = Jstr . v " sign " let veri... |
module Crypto_algo = struct type big_integer = Tarray . uint8 type t = Crypto_key . algo type algo = t include ( Jv . Id : Jv . CONV with type t := t ) let v n = Jv . obj [ | " name " , Jv . of_jstr n ] | let name a = Jv . Jstr . get a " name " let rsassa_pkcs1_v1_5 = Jstr . v " RSASSA - PKCS1 - v1_5 " module Rsa_hashe... |
module Subtle_crypto = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let encrypt s a k d = Fut . of_promise ~ ok : Tarray . Buffer . of_jv @@ Jv . call s " encrypt " [ | Crypto_algo . to_jv a ; Crypto_key . to_jv k ; Tarray . to_jv d ] | let decrypt s a k d = Fut . of_promise ~ ok : Tarray . B... |
module Crypto = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let crypto = Jv . get Jv . global " crypto " let subtle c = Jv . get c " subtle " let set_random_values c a = ignore @@ Jv . call c " getRandomValues " [ | Tarray . to_jv a ] | end |
module Midi = struct module Port = struct type t = Jv . t include ( Jv . Id : Jv . CONV with type t := t ) let as_target = Ev . target_of_jv let open ' p = Fut . of_promise ~ ok : ignore @@ Jv . call p " open " [ ] || let close p = Fut . of_promise ~ ok : ignore @@ Jv . call p " close " [ ] || let [ @ inline ] get_null... |
module Worker = struct module Type = struct type t = Jstr . t let classic = Jstr . v " classic " let module ' = Jstr . v " module " end type opts = Jv . t let opts ? type ' ? credentials ? name ( ) = let o = Jv . obj ' [ ] || in Jv . Jstr . set_if_some o " type " type ' ; Jv . Jstr . set_if_some o " credentials " crede... |
module Service_worker = struct module Update_via_cache = struct type t = Jstr . t let imports = Jstr . v " imports " let all = Jstr . v " all " let none = Jstr . v " none " end module State = struct type t = Jstr . t let parsed = Jstr . v " parsed " let installing = Jstr . v " installing " let installed = Jstr . v " in... |
let pivot_level = 2 * lowest_level - 1 |
let new_id = ref ( - 1 ) |
let newty2 level desc = incr new_id ; { desc = desc ; level = level ; id = ! new_id } |
let newgenty desc = newty2 generic_level desc |
let newgenvar ( ) = newgenty Tvar |
let rec field_kind_repr = function Fvar { contents = Some kind } -> field_kind_repr kind | kind -> kind |
let rec repr = function { desc = Tlink t ' } -> repr t ' | { desc = Tfield ( _ , k , _ , t ' ) } when field_kind_repr k = Fabsent -> repr t ' | t -> t |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.