text
stringlengths
0
601k
type a = { a : b } [ @@ unboxed ]
let rec a = { a = ( if Sys . opaque_identity true then X a else Y ) } ; ; [ %% expect { |
type a = { a : b ; } [ @@ unboxed ] } ] ; ; |
type d = D of e [ %% expect { |
type d = D of e } ] ; ; |
let rec d = D ( if Sys . opaque_identity true then V d else W ) ; ; [ %% expect { | } ] ; ; |
type d = D of e [ @@ unboxed ]
let rec d = D ( if Sys . opaque_identity true then V d else W ) ; ; [ %% expect { |
type d = D of e [ @@ unboxed ] } ] ; ; |
module Transform = struct let pass_name = " unbox - closures " let precondition ~ env ( ~ set_of_closures : Flambda . set_of_closures ) = ! Clflags . unbox_closures && not ( E . at_toplevel env ) && not ( Variable . Map . is_empty set_of_closures . free_vars ) let what_to_specialise ~ env ( ~ set_of_closures : Flambda ...
let ( ) = Pass_wrapper . register ~ pass_name
let add_lifted_projections_around_set_of_closures ~ set_of_closures ~ existing_inner_to_outer_vars ~ benefit ~ definitions_indexed_by_new_inner_vars = let body = Flambda_utils . name_expr ( Set_of_closures set_of_closures ) ~ name : Internal_variable_names . unbox_free_vars_of_closures in Variable . Map . fold ( fun ne...
let run ~ env ( ~ set_of_closures : Flambda . set_of_closures ) = if not ! Clflags . unbox_free_vars_of_closures then None else let definitions_indexed_by_new_inner_vars , _ , free_vars , done_something = let all_existing_definitions = Variable . Map . fold ( fun _inner_var ( outer_var : Flambda . specialised_to ) all_...
let run ~ env ~ set_of_closures = Pass_wrapper . with_dump ~ ppf_dump ( : Inline_and_simplify_aux . Env . ppf_dump env ) ~ pass_name ~ input : set_of_closures ~ print_input : Flambda . print_set_of_closures ~ print_output ( : fun ppf ( expr , _ ) -> Flambda . print ppf expr ) ~ f ( : fun ( ) -> run ~ env ~ set_of_closu...
module Transform = struct let pass_name = " unbox - specialised - args " let precondition ~ env : _ ( ~ set_of_closures : Flambda . set_of_closures ) = ! Clflags . unbox_specialised_args && not ( Variable . Map . is_empty set_of_closures . specialised_args ) let what_to_specialise ~ env ( ~ set_of_closures : Flambda . ...
module Float = struct type _ t = | IO : int option t | F : float t let bar : type a . a t -> float -> int -> a = fun t f i -> match t with | IO -> Some i | F -> f [ @@ inline always ] let foo ( t : float t ) f i = let r = ref 0 . in r := bar t f i end
module Int32 = struct type _ t = | IO : int option t | F : int32 t let bar : type a . a t -> int32 -> int -> a = fun t f i -> match t with | IO -> Some i | F -> f [ @@ inline always ] let foo ( t : int32 t ) f i = let r = ref 0l in r := bar t f i end
module Int64 = struct type _ t = | IO : int option t | F : int64 t let bar : type a . a t -> int64 -> int -> a = fun t f i -> match t with | IO -> Some i | F -> f [ @@ inline always ] let foo ( t : int64 t ) f i = let r = ref 0L in r := bar t f i end
module Nativeint = struct type _ t = | IO : int option t | F : nativeint t let bar : type a . a t -> nativeint -> int -> a = fun t f i -> match t with | IO -> Some i | F -> f [ @@ inline always ] let foo ( t : nativeint t ) f i = let r = ref 0n in r := bar t f i end
let kasprintf k fmt = Format . ( kfprintf ( fun _ -> k ( flush_str_formatter ( ) ) ) str_formatter fmt )
let invalid_arg fmt = kasprintf invalid_arg ( " Nocrypto : " ^^ fmt )
let failwith fmt = kasprintf failwith ( " Nocrypto : " ^^ fmt )
let ( ) // x y = if y < 1 then raise Division_by_zero else if x > 0 then 1 + ( ( x - 1 ) / y ) else 0 [ @@ inline ]
let imin ( a : int ) b = if a < b then a else b
let imax ( a : int ) b = if a < b then b else a
let ( . ) & f g = fun h -> f ( g h )
let id x = x
let rec until p f = let r = f ( ) in if p r then r else until p f
module Option = struct let get_or f x = function None -> f x | Some y -> y let ( ) >>= a fb = match a with Some x -> fb x | _ -> None let ( ) >>| a f = match a with Some x -> Some ( f x ) | _ -> None let v_map ~ def ~ f = function | Some x -> f x | None -> def let get ~ def = function | Some x -> x | None -> def let ma...
type ' a iter = ( ' a -> unit ) -> unit
let iter1 a f = f a
let iter2 a b f = f a ; f b
let iter3 a b c f = f a ; f b ; f c
let string_fold ~ f ~ z str = let st = ref z in ( String . iter ( fun c -> st := f ! st c ) str ; ! st )
module Z = struct include Z let two = ~$ 2 let three = ~$ 3 let pp = pp_print open Sexplib . Conv let sexp_of_t z = sexp_of_string ( Z . to_string z ) let t_of_sexp s = Z . of_string ( string_of_sexp s ) end
module Cs = struct open Cstruct let empty = create 0 let null cs = len cs = 0 let ( ) <+> = append let ct_eq cs1 cs2 = let rec go ok i = function | n when n >= 8 -> go ( LE . ( get_uint64 cs1 i = get_uint64 cs2 i ) && ok ) ( i + 8 ) ( n - 8 ) | n when n >= 4 -> go ( LE . ( get_uint32 cs1 i = get_uint32 cs2 i ) && ok ) ...
module Array = struct include Array let mem x arr = let rec scan = function | - 1 -> false | n -> arr . ( n ) = x || scan ( pred n ) in scan ( Array . length arr - 1 ) end
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 do f i ( off + i |> getu8 xs ) done and spa...
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 ; mutable prev : int ; } let undos = Sta...
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 \ where < public_key > is the ...
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 constructor Any introduces existential types . ...
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_channel class nfkc : UChar . t # obj...
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 decomposition_tbl u let composition_excl...
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 ) Types . Step . Proof_state . Per...
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_circuit . to_data ~ back : Types . Ste...
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 out ( ` Uchar Uutf . u_bom ) ; loop d ...
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 -> add v ; out ` End | ` Malformed bs -> log_mal...
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 out | Some nf -> normalize nf in...
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 . " in let nfc = Some ` NFC , Arg . info [ " nfc " ...
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 unspecified the encoding is \ guessed . The output encoding is the same as the input...
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 character stream is left intact . " ; ` ...
let ( ) = match Term . eval cmd with
module Sessions = Hlist . Make ( LinState )