text stringlengths 0 601k |
|---|
let initialize ( ) = let ( ) = Random . self_init ( ) in let settings = Defaults . default_settings in let ( ) = setup_logging settings . verbose settings . debug in let * config_file = try Ok ( Unix . getenv Defaults . config_path_env_var ) with Not_found -> find_config_file ( ) in let * config = Config . read_config ... |
let dump_index_json settings index = match settings . dump_index_json with | None -> Ok ( ) | Some f -> let ( ) = Logs . info @@ fun m -> m " Exporting index data to JSON file % s " f in try Ok ( Soup . write_file f @@ Autoindex . json_string_of_entries index ) with Sys_error e -> Error e |
let check_version settings = match settings . soupault_version with | None -> ( ) | Some v -> try let res = Utils . require_version v in if res then ( ) else begin Printf . printf " According to settings . soupault_version , this configuration file is for soupault % s \ n " v ; Printf . printf " You are running soupaul... |
let process_page_files index_hash widgets hooks config settings files = Utils . fold_left ( fun acc p -> let ie = process_page [ ] index_hash widgets hooks config settings p in match ie with Ok ( None , _ ) -> Ok acc | Ok ( Some ie ' , _ ) -> Ok ( ie ' :: acc ) | Error _ as err -> err ) [ ] files |
let process_index_files index index_hash widgets hooks config settings files = Utils . fold_left ( fun acc p -> let ie = process_page index index_hash widgets hooks config settings p in match ie with | Ok ( _ , [ ] ) -> Ok acc | Ok ( _ , new_pages ) -> Ok ( List . append new_pages acc ) | Error _ as err -> err ) [ ] fi... |
let main ( ) = let * ( action , settings ) = get_args Defaults . default_settings in match action with | ShowVersion -> let ( ) = Utils . print_version ( ) in exit 0 | ShowDefaultConfig -> let ( ) = print_endline Project_init . default_config in exit 0 | InitProject -> let ( ) = if ( settings . site_dir <> Defaults . d... |
let ( ) = let res = main ( ) in match res with | Ok _ -> exit 0 | Error e -> Logs . err @@ fun m -> m " % s " e ; exit 1 |
let ( x [ @ foo ] ) : unit [ @ foo ] = ( ) [ @ foo ] [ @@ foo ] |
type t = | Foo of ( t [ @ foo ] ) [ @ foo ] [ @@ foo ] [ @@@ foo ] |
module M = struct type t = { l : ( t [ @ foo ] ) [ @ foo ] } [ @@ foo ] [ @@ foo ] [ @@@ foo ] end [ @ foo ] [ @@ foo ] |
module type S = sig include ( module type of ( M [ @ foo ] ) ) [ @ foo ] with type t := M . t [ @ foo ] [ @@ foo ] [ @@@ foo ] end [ @ foo ] [ @@ foo ] [ @@@ foo ] |
type ' a with_default = ? size : int -> ? resizable : bool -> ' a |
type obj = < meth1 : int -> int ; meth2 : unit -> float ; > |
type var = [ | ` Foo | ` Bar of int * string ] |
let [ % foo 2 + 1 ] : [ % foo bar . baz ] = [ % foo " foo " ] |
let [ % foo let ( ) = ( ) ] : [ % foo type t = t ] = [ % foo class c = object end ] |
let [ % foo : [ ` Foo ] ] : [ % foo : t -> t ] = [ % foo : < foo : t > ] |
let [ % foo ? ( Bar x | Baz x ) ] : [ % foo ? # bar ] = [ % foo ? { x } ] |
let [ % foo : include S with type t = t ] : [ % foo : val x : t val y : t ] = [ % foo : type t = t ] |
let ( ) = let % foo [ @ foo ] x = 3 and [ @ foo ] y = 4 in ( let module % foo [ @ foo ] M = M in ( ) ) ; ( let open % foo [ @ foo ] M in ( ) ) ; ( fun % foo [ @ foo ] x -> ( ) ) ; ( function % foo [ @ foo ] x -> ( ) ) ; ( try % foo [ @ foo ] ( ) with _ -> ( ) ) ; ( if % foo [ @ foo ] ( ) then ( ) else ( ) ) ; while % f... |
type t = ( module % foo [ @ foo ] M ) |
module M = functor [ @ foo ] ( M : S ) -> ( val [ @ foo ] x ) ( struct [ @ foo ] end ) |
module type S = functor [ @ foo ] ( M : S ) -> ( module type of [ @ foo ] M ) -> ( sig [ @ foo ] end ) |
module type S = S -> S -> S |
module type S = ( S -> S ) -> S |
module type S = functor ( M : S ) -> S -> S |
module type S = ( functor ( M : S ) -> S ) -> S |
module type S = ( S -> S ) [ @ foo ] -> S |
module type S = ( functor [ @ foo ] ( M : S ) -> S ) -> S |
module type S = sig module rec A : ( S with type t = t ) and B : ( S with type t = t ) end |
module type % foo [ @ foo ] S = S |
module type S = sig val % foo [ @ foo ] x : t external % foo [ @ foo ] x : t = " " type % foo [ @ foo ] t = int and [ @ foo ] t ' = int type % foo [ @ foo ] t += T exception % foo [ @ foo ] X module % foo [ @ foo ] M : S module % foo [ @ foo ] rec M : S and [ @ foo ] M : S module % foo [ @ foo ] M = M module type % foo... |
module M = struct type extension_constructor = int end ; ; |
type ' a class_name = . . constraint ' a = < cast : ' a . ' a name -> ' a ; . . > Class : ' a class_name -> ( < cast : ' a . ' a name -> ' a ; . . > as ' a ) name ; ; ; ; object method cast : ' a . ' a name -> ' a end ; ; object inherit castable method foo : string end ; ; |
type ' a class_name += Foo : foo_t class_name ; ; object ( self ) method cast : type a . a name -> a = function Class Foo -> ( self :> foo_t ) | _ -> ( ( raise Bad_cast ) : a ) method foo = " foo " end ; ; object inherit foo method bar : string end ; ; |
type ' a class_name += Bar : bar_t class_name ; ; object ( self ) inherit foo as super method cast : type a . a name -> a = function Class Bar -> ( self :> bar_t ) | other -> super # cast other method bar = " bar " [ @@@ id ] [ %% id ] end ; ; |
let clist : castable list ref = ref [ ] ; ; |
let push_castable ( c : # castable ) = clist := ( c :> castable ) :: ! clist ; ; |
let pop_castable ( ) = match ! clist with c :: rest -> clist := rest ; c | [ ] -> raise Not_found ; ; |
let c1 : castable = pop_castable ( ) ; ; |
let c2 : castable = pop_castable ( ) ; ; |
let c3 : castable = pop_castable ( ) ; ; |
let f1 : foo = c1 # cast ( Class Foo ) ; ; |
let f2 : foo = c2 # cast ( Class Foo ) ; ; |
let f3 : foo = c3 # cast ( Class Foo ) ; ; |
let b1 : bar = c1 # cast ( Class Bar ) ; ; |
let b2 : bar = c2 # cast ( Class Bar ) ; ; |
let b3 : bar = c3 # cast ( Class Bar ) ; ; |
type foo = . . ; ; |
type foo += A | B of int ; ; |
let is_a x = match x with A -> true | _ -> false ; ; |
type foo += A of int ; ; |
type ' a foo = . . ; ; |
type ( ' a , ' b ) foo += A of int ; ; |
module type S = sig type foo type foo += A of float end ; ; |
module type S = sig type foo = A of int type foo += B of float end ; ; |
type foo = . . ; ; |
module M = struct type foo += A of int | B of string type foo += C of int | D of float end ; ; |
module type S = sig type foo += B of string | C of int type foo += D of float type foo += A of int end ; ; |
module M_S = ( M : S ) ; ; |
type ' a foo = . . ; ; |
type _ foo += A : int -> int foo | B : int foo ; ; |
let get_num : type a . a foo -> a -> a option = fun f i1 -> match f with A i2 -> Some ( i1 + i2 ) | _ -> None ; ; |
type ' a foo = . . constraint ' a = [ > ` Var ] ; ; |
type ' a foo += A of ' a ; ; |
let a = A 9 ; ; |
type ' a foo += B : int foo ; ; |
type foo = . . ; ; |
module M = struct type foo += A of int end ; ; |
let a1 = M . A 10 ; ; |
module type S = sig type foo += private A of int end ; ; |
module M_S = ( M : S ) ; ; |
let is_s x = match x with M_S . A _ -> true | _ -> false ; ; |
let a2 = M_S . A 20 ; ; |
type foo = . . ; ; |
module M = struct type foo += A1 of int end ; ; |
type foo += A2 = M . A1 ; ; |
type bar = . . ; ; |
type bar += A3 = M . A1 ; ; |
module M = struct type foo += private B1 of int end ; ; |
type foo += private B2 = M . B1 ; ; |
type foo += B3 = M . B1 ; ; |
type foo += C = Unknown ; ; |
module M : sig type foo type foo += A1 of int end = struct type foo = . . type foo += A1 of int end |
type M . foo += A2 = M . A1 |
type ' a foo = . . ; ; |
type ' a foo1 = ' a foo = . . ; ; |
type ' a foo2 = ' a foo = . . ; ; |
type ' a foo1 += A of int | B of ' a | C : int foo1 ; ; |
type ' a foo2 += D = A | E = B | F = C ; ; |
type ' + a foo = . . ; ; |
type ' a foo += A of ( int -> ' a ) ; ; |
type ' a foo += B of ( ' a -> int ) ; ; |
type _ foo += C : ( ' a -> int ) -> ' a foo ; ; |
type ' a bar = . . ; ; |
type ' + a bar += D of ( int -> ' a ) ; ; |
module M : sig type exn += Foo of int * float | Bar : ' a list -> exn exception Bar : ' a list -> exn exception Foo of int * float end ; ; |
module M : sig exception Bar : ' a list -> exn exception Foo of int * float type exn += Foo of int * float | Bar : ' a list -> exn end ; ; ; ; ; ; |
module M : sig type exn += Foo of int * float | Bar : ' a list -> exn exception Bar = Bar exception Foo = Foo end ; ; |
type foo = . . ; ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.