text stringlengths 12 786k |
|---|
module List = struct include List let find_opt p xs = try Some ( find p xs ) with Not_found -> None end |
let bracket ~ init ~ fini f = let a = init ( ) in match f a with | exception exn -> fini a ; raise exn | res -> fini a ; res |
let pp_xd_gen getu8 len ( ? address = true ) ( ? ascii = false ) ( ? w = 16 ) ( ) ppf = let open Format in let rec blocks f off xs = let n = len xs - off in f off ( min n w ) xs ; if n > w then blocks f ( off + w ) xs in let line ppf off n xs = let iter f = for i = 0 to n - 1... |
let xd = Cstruct . ( pp_xd_gen get_uint8 len ) |
let xdb = Bytes . ( pp_xd_gen ( fun b i -> Char . code ( get b i ) ) length ) |
module Boot = struct exception Unseeded_generator end |
type action = | Insert of action_insert | Delete of action_delete | Begin_block of string | End_block of string | Func of ( ( unit -> bool ) * ( unit -> bool ) ) mutable pos : int ; mutable length : int ; } mutable text : string ; mutable where : int ; mutable bounds : int * int ; ... |
let title = " Built - in signer using raw unencrypted keys . " |
let description = " Please DO NOT USE this signer outside of test environments . \ n \ Valid secret key URIs are of the form \ n \ \ - unencrypted :< key >\ n \ where < key > is the secret key in Base58 . \ n \ Valid public key URIs are of the form \ n \ \ - unencrypted :< public_key >\ n \ w... |
let secret_key sk_uri = Lwt . return ( Signature . Secret_key . of_b58check ( Uri . path ( sk_uri : sk_uri :> Uri . t ) ) ) |
let make_sk sk = Client_keys . make_sk_uri ( Uri . make ~ scheme ~ path ( : Signature . Secret_key . to_b58check sk ) ( ) ) |
let make_sapling_key sk = let path = Base58 . simple_encode Tezos_sapling . Core . Wallet . Spending_key . b58check_encoding sk in Client_keys . make_sapling_uri ( Uri . make ~ scheme ~ path ( ) ) |
let public_key pk_uri = Lwt . return ( Signature . Public_key . of_b58check ( Uri . path ( pk_uri : pk_uri :> Uri . t ) ) ) |
let make_pk pk = Client_keys . make_pk_uri ( Uri . make ~ scheme ~ path ( : Signature . Public_key . to_b58check pk ) ( ) ) |
let neuterize sk_uri = secret_key sk_uri >>=? fun sk -> make_pk ( Signature . Secret_key . to_public_key sk ) >>?= return |
let public_key_hash pk_uri = public_key pk_uri >>=? fun pk -> return ( Signature . Public_key . hash pk , Some pk ) |
let import_secret_key ~ io : _ = public_key_hash |
let sign ? watermark sk_uri buf = secret_key sk_uri >>=? fun sk -> return ( Signature . sign ? watermark sk buf ) |
let deterministic_nonce sk_uri buf = secret_key sk_uri >>=? fun sk -> return ( Signature . deterministic_nonce sk buf ) |
let deterministic_nonce_hash sk_uri buf = secret_key sk_uri >>=? fun sk -> return ( Signature . deterministic_nonce_hash sk buf ) |
let supports_deterministic_nonces _ = return_true |
type any = Any : ' a -> any |
type any = Any : ' a -> any } ] | |
let Any x = Any ( ) ^^^^^ but this pattern introduces the existential type $ Any_ ' a . } ] | |
let ( ) = let Any x = Any ( ) and ( ) = ( ) in ( ) ^^^^^ but this pattern introduces the existential type $ Any_ ' a . } ] | |
let ( ) = let rec Any x = Any ( ) in ( ) ^^^^^ but this pattern introduces the existential type $ Any_ ' a . } ] | |
let ( ) = let [ @ attribute ] Any x = Any ( ) in ( ) ^^^^^ but this pattern introduces the existential type $ Any_ ' a . } ] | ^^^^^^^ but this pattern introduces the existential type $ Any_ ' a . } ] | ^^^^^^^ but this pattern introduces the existential type $ Any_ ' a . ... |
type other = Any : _ -> other |
type other = Any : ' a -> other } ] | |
let Any x = Any ( ) ^^^^^ but the constructor Any introduces existential types . } ] | ^^^^^^ but the constructor Any introduces existential types . } ] | |
let ( ) = let Any x = Any ( ) and ( ) = ( ) in ( ) ^^^^^ but the constructor Any introduces existential types . } ] | |
let ( ) = let rec Any x = Any ( ) in ( ) ^^^^^ but the constructor Any introduces existential types . } ] | |
let ( ) = let [ @ attribute ] Any x = Any ( ) in ( ) ^^^^^ but the constructor Any introduces existential types . } ] | ^^^^^^^ but the constructor Any introduces existential types . } ] | ^^^^^^^ but the constructor Any introduces existential types . } ] | ^^^^^^ but the con... |
module type Type = sig type text open OOChannel class nfd : UChar . t # obj_output_channel -> [ UChar . t ] t obj_output_channel class nfc : UChar . t # obj_output_channel -> [ UChar . t ] t obj_output_channel class nfkd : UChar . t # obj_output_channel -> [ UChar . t ] t obj_output_chann... |
module Make ( Config : ConfigInt . Type ) Type ( Text : UnicodeString . Type ) Type = struct module UInfo = UCharInfo . Make ( MakeConfig ) MakeConfig let null = UChar . chr_of_uint 0 let decomposition_tbl = UInfo . load_decomposition_tbl ( ) let decomposition u = UCharTbl . get decompo... |
type t = ( Field . t , Field . t Scalar_challenge . t , Other_field . t Shifted_value . t , ( Field . t Scalar_challenge . t Bulletproof_challenge . t , Tock . Rounds . n ) Pickles_types . Vector . t , Field . t , Boolean . var ) Types . Step . Proof_state . Per_proof . In_circuit . t |
module Plonk_checks = struct include Plonk_checks include Plonk_checks . Make ( Shifted_value ) Shifted_value ( Plonk_checks . Scalars . Tock ) Tock end |
module Constant = struct type t = ( Challenge . Constant . t , Challenge . Constant . t Scalar_challenge . t , Tock . Field . t Shifted_value . t , ( Challenge . Constant . t Scalar_challenge . t Bulletproof_challenge . t , Tock . Rounds . n ) Vector . t , Digest . Constant . t , bool ) ... |
let typ ~ wrap_rounds : ( t , Constant . t ) t Typ . t = Types . Step . Proof_state . Per_proof . In_circuit . spec wrap_rounds |> Spec . typ ( module Impl ) Impl ( Shifted_value . typ Other_field . typ ) typ |> Typ . transport ~ there : Types . Step . Proof_state . Per_proof . In... |
let pp_pos ppf d = pp ppf " % d . % d ( :% d , % 06X ) " ( Uutf . decoder_line d ) ( Uutf . decoder_col d ) ( Uutf . decoder_count d ) ( Uutf . decoder_byte_count d ) |
let pp_malformed ppf bs = let l = String . length bs in pp ppf " [ @ malformed bytes [ ( " ; @ if l > 0 then pp ppf " % 02X " ( Char . code ( bs . [ 0 ] ) ) ; for i = 1 to l - 1 do pp ppf " @ % 02X " ( Char . code ( bs . [ i ] ) ) done ; pp ppf "... |
let pp_dump_uchar ppf u = Format . fprintf ppf " U +% 04X " ( Uchar . to_int u ) |
let exec = Filename . basename Sys . executable_name |
let log f = Format . eprintf ( " % s : " ^^ f ^^ " " ) @? exec |
let input_malformed = ref false |
let log_malformed inf d bs = input_malformed := true ; log " % s :% a : % a . " @ inf pp_pos d pp_malformed bs |
let uchar_dump ppf = function |
let uchar_encoder enc = let enc = match enc with ` ISO_8859_1 | ` US_ASCII -> ` UTF_8 | # Uutf . encoding as enc -> enc in let e = Uutf . encoder enc ( ` Channel stdout ) in fun v -> ignore ( Uutf . encode e v ) |
let out_fun ascii oe = if ascii then uchar_dump Format . std_formatter else uchar_encoder oe |
let u_rep = ` Uchar Uutf . u_rep |
let id inf d first_dec out = let rec loop d = function | ` Uchar _ as v -> out v ; loop d ( Uutf . decode d ) | ` End as v -> out v | ` Malformed bs -> log_malformed inf d bs ; out u_rep ; loop d ( Uutf . decode d ) | ` Await -> assert false in if Uutf . decoder_removed_bom d then... |
let normalize nf inf d first_dec out = let n = Uunf . create nf in let rec add v = match Uunf . add n v with | ` Uchar cp as u -> out u ; add ` Await | ` Await | ` End -> ( ) in let rec loop d = function | ` Uchar _ as v -> add v ; loop d ( Uutf . decode d ) | ` End as v -> a... |
let trip nf inf enc ascii = try let ic = if inf = " " - then stdin else open_in inf in let d = Uutf . decoder ? encoding : enc ( ` Channel ic ) in let first_dec = Uutf . decode d in let out = out_fun ascii ( Uutf . decoder_encoding d ) in begin match nf with | None -> id inf d first_dec o... |
let unicode_version ( ) = Format . printf " % s . " @ Uunf . unicode_version |
let do_cmd cmd nf inf enc ascii = match cmd with |
let cmd = let doc = " Output supported Unicode version . " in let unicode_version = ` Unicode_version , Arg . info [ " unicode - version " ] ~ doc in Arg . ( value & vflag ` Trip [ unicode_version ] ) |
let nf = let docs = nf_doc in let doc = " Normalization Form D ( NFD ) , canonical decomposition . " in let nfd = Some ` NFD , Arg . info [ " nfd " ] ~ doc ~ docs in let doc = " Normalization Form C ( NFC ) , canonical decomposition followed by \ canonical composition . " i... |
let file = let doc = " The input file . Reads from stdin if unspecified . " in Arg . ( value & pos 0 string " " - & info [ ] ~ doc ~ docv " : FILE " ) |
let enc = let enc = [ " UTF - 8 " , ` UTF_8 ; " UTF - 16 " , ` UTF_16 ; " UTF - 16LE " , ` UTF_16LE ; " UTF - 16BE " , ` UTF_16BE ; " ASCII " , ` US_ASCII ; " latin1 " , ` ISO_8859_1 ] in let doc = strf " Input encoding , must % s . If unsp... |
let ascii = let doc = " Output the input text as newline ( U + 000A ) separated Unicode scalar values written in the US - ASCII charset . " in Arg . ( value & flag & info [ " a " ; " ascii " ] ~ doc ) |
let cmd = let doc = " normalize Unicode text " in let man = [ ` S " DESCRIPTION " ; ` P " ( $ tname ) inputs Unicode text from stdin and rewrites it to stdout according to a specified Unicode normalization form ( see UAX 15 ) . " ; ` P " If no normalization form is specified the... |
let ( ) = match Term . eval cmd with |
module Sessions = Hlist . Make ( LinState ) |
type ' s select = ' s ActionOut . select |
type ' s branch = ' s ActionInp . branch |
type ( ' v , ' s ) out = ( ' v , ' s ) ActionOut . out |
type ( ' v , ' s ) inp = ( ' v , ' s ) ActionInp . inp |
let close ( ) = ( ) |
type chan_table = ( string * string , DynChan . chan ) Hashtbl . t |
module UnicastEnv : EnvSpec with type entry = chan_table = struct type entry = chan_table type env_entry += E of entry let name = " unicast " let make_default ( ) = Hashtbl . create 42 let update _param _tbl = ( ) end |
module Lookup = RegisterEnvSpec ( UnicastEnv ) |
let lookup ( t : chan_table ) ( key : string * string ) = match Hashtbl . find_opt t key with | Some ch -> ch | None -> let ch = DynChan . make ( ) in Hashtbl . add t key ch ; ch |
let ( --> ) ra rb lab g env = let g = g env in let ch = lookup ( Lookup . lookup env ) ( ra . role_label . method_name , rb . role_label . method_name ) in let key = DynChan . new_name ch in let b = seq_get rb . role_index g in let g = seq_put rb . role_index g ( ActionInp . mak... |
let ( ==> ) ra rb g env = let g = g env in let ch = lookup ( Lookup . lookup env ) ( ra . role_label . method_name , rb . role_label . method_name ) in let key = DynChan . new_name ch in let b = seq_get rb . role_index g in let g = seq_put rb . role_index g ( ActionInp . make_in... |
let secondary_mask = 0xff lsl 7 let tertiary_mask = 0x7f let primary ce = ( ce land primary_mask ) primary_mask lsr 15 let secondary ce = ( ce land secondary_mask ) secondary_mask lsr 7 let tertiary ce = ce land tertiary_mask let compose_ce w1 w2 w3 = ( w1 lsl 15 ) 15 lor ( w2 lsl 7 ) 7 l... |
module Logs = ( val Logs . ( src_log @@ Src . create __MODULE__ ) ) |
module Stack : sig type elt = | Var of Variable . t * Type . t | Expr of Type . t * Type . t type t val empty : t val pop : t -> ( elt * t ) option val push_quasi_solved : t -> Variable . t -> Type . t -> t val push_array2 : Type . t array -> Type . t array -> t -> t val [ @ war... |
type return = | Done | FailUnif of Type . t * Type . t | FailedOccurCheck of Env . t |
let ( let ) * x1 f = match x1 with Done -> f ( ) | _ -> x1 |
let occur_check env : return = debug ( fun m -> m " [ @< v > Occur check in , @% a ] " @ Env . pp env ) ; let nb_predecessors = Variable . HMap . create 17 in let successors = Variable . HMap . create 17 in let fill_nb_predecessors x ty = let aux y = Variable . HMap . incr nb_... |
let rec process_stack env ( stack : Stack . t ) : return = match Stack . pop stack with | Some ( Expr ( t1 , t2 ) , stack ) -> insert_rec env stack t1 t2 | Some ( Var ( v , t ) , stack ) -> insert_var env stack v t | None -> Done match t1 , t2 with | _ when t1 == t2 -> pro... |
let insert env t u : return = insert_rec env Stack . empty t u |
let insert_var env x ty : return = insert_var env Stack . empty x ty |
let insert_tuple_solution env sol = let exception Bail of return in try let f ( k , v ) = match insert_var env k ( ACTerm . as_tuple ( Env . tyenv env ) v ) with | Done -> ( ) | r -> raise ( Bail r ) in sol f ; Done with | Bail r -> r |
let rec solve_tuple_problems env0 = let rec pop_all_tuples acc env = match Env . pop_tuple env with | None -> acc | Some pb -> pop_all_tuples ( pb :: acc ) env in AC . solve env0 @@ pop_all_tuples [ ] env0 |> Iter . flat_map ( try_with_solution env0 insert_tuple_solution ) let potentials = [... |
let unifiers ( tyenv : Type . Env . t ) t1 t2 : Subst . t Iter . t = let orig_vars = Variable . Set . ( union ( of_iter @@ Type . iter_vars t1 ) ( of_iter @@ Type . iter_vars t2 ) ) in let env0 = Env . make ~ tyenv ~ orig_vars in debug ( fun m -> m { [ |@< v > Unify ... |
let unify ( env : Type . Env . t ) t1 t2 = Iter . min ~ lt : Subst . lt @@ unifiers env t1 t2 |
let unifiable ( env : Type . Env . t ) t1 t2 = not @@ Iter . is_empty @@ unifiers env t1 t2 |
type ord = | Uncomparable | Smaller | Bigger | Equal |
let compare env t1 t2 = let b1 = unifiable env ( Type . freeze_variables env t1 ) t2 and b2 = unifiable env t1 ( Type . freeze_variables env t2 ) in match b1 , b2 with | true , true -> Equal | false , false -> Uncomparable | true , false -> Smaller | false , true -> Bigger |
module type Monad = sig type ' a m val return : ' a -> ' a m val bind : ' a m -> ( ' a -> ' b m ) -> ' b m end |
module type Extend = sig type ' a m val fmap : ( ' a -> ' b ) -> ' a m -> ' b m end |
module Extend ( M : Monad ) : Extend with type ' a m := ' a M . m = struct open M let fmap f m = bind m ( fun a -> return ( f a ) ) end |
module Option = struct type ' a t = ' a option module Monad = struct type ' a m = ' a t let return x = Some x let bind m f = match m with | None -> None | Some a -> f a end include Monad include Extend ( Monad ) end |
module type Monad2 = sig type ( ' a , ' x ) m val return : ' a -> ( ' a , ' x ) m val bind : ( ' a , ' x ) m -> ( ' a -> ( ' b , ' x ) m ) -> ( ' b , ' x ) m end |
module Extend2 ( M : Monad2 ) : sig open M val fmap : ( ' a -> ' b ) -> ( ' a , ' x ) m -> ( ' b , ' x ) m include M let fmap f m = bind m ( fun a -> return ( f a ) ) end |
module Result = struct type ( ' a , ' err ) t = Ok of ' a | Error of ' err module Monad = struct type ( ' a , ' err ) m = ( ' a , ' err ) t let return x = Ok x let bind m f = match m with | Error e -> Error e | Ok a -> f a end include Monad include Extend2 ( Monad ) end |
module Option ' = struct type ' a t = ' a option module Monad = struct type ( ' a , _ ) m = ' a t let return x = Some x let bind m f = match m with | None -> None | Some a -> f a end include Monad include ( Extend2 ( Monad ) : Extend with type ' a m := ' a t ) end |
module Make ( D : Debugger . S_base ) = struct include D module Value = struct type t = | Exists_on_target of Obj . t | Synthetic_ptr of Synthetic_ptr . t let create_exists_on_target obj = Exists_on_target obj let create_synthetic_ptr ptr = Synthetic_ptr ptr let is_block t = match t with | Exists_on... |
module type STRUCTURE = sig type ' a structure val map : ( ' a -> ' b ) -> ' a structure -> ' b structure val iter : ( ' a -> unit ) -> ' a structure -> unit exception Iter2 val iter2 : ( ' a -> ' b -> unit ) -> ' a structure -> ' b structure -> unit end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.