From 37f8f4cdf8ec06f46170411cb36126868d339b9c Mon Sep 17 00:00:00 2001 From: just-max Date: Mon, 15 Jul 2024 02:55:06 +0000 Subject: [PATCH] deploy: 8b63646d6881103601c097646163da8cf03ce384 --- .../less-power/Common/Ctx_util/Syntax/index.html | 2 ++ .../less-power/Common/Ctx_util/index.html | 8 ++++---- .../less-power/Common/Util/index.html | 2 +- .../less-power/Test_runner/Std_task/index.html | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 stdlib-variants-structure/less-power/Common/Ctx_util/Syntax/index.html diff --git a/stdlib-variants-structure/less-power/Common/Ctx_util/Syntax/index.html b/stdlib-variants-structure/less-power/Common/Ctx_util/Syntax/index.html new file mode 100644 index 0000000..0c0a3f7 --- /dev/null +++ b/stdlib-variants-structure/less-power/Common/Ctx_util/Syntax/index.html @@ -0,0 +1,2 @@ + +Syntax (less-power.Common.Ctx_util.Syntax)

Module Ctx_util.Syntax

val let< : ('a, 'b, 'c) t -> ('a -> 'b) -> 'c

Let-syntax for with_context

diff --git a/stdlib-variants-structure/less-power/Common/Ctx_util/index.html b/stdlib-variants-structure/less-power/Common/Ctx_util/index.html index 390a1c6..b832491 100644 --- a/stdlib-variants-structure/less-power/Common/Ctx_util/index.html +++ b/stdlib-variants-structure/less-power/Common/Ctx_util/index.html @@ -1,7 +1,7 @@ -Ctx_util (less-power.Common.Ctx_util)

Module Common.Ctx_util

Context managers, loosely inspired by Python

type exn_info = {
  1. exn : exn;
  2. backtrace : Stdlib.Printexc.raw_backtrace;
}

Exception and its associated (raw) backtrace.

type ('a, 'b, 'c) t = - ('a -> ('b, exn_info) Stdlib.result) -> - ('c, exn_info) Stdlib.result

A context manager of type ('a, 'b, 'c) t takes a continuation, and should feed the continuation a value of type 'a. Once the continuation returns with either a Ok of 'b or an exn_info, the continuation should perform cleanup, and may suppress the exception by producing a suitable result (of type 'c) instead. Often, 'b = 'c.

This representation has the advantage that some existing functions library already implement this type (e.g. In_channel.with_open_text).

val with_context : ('a, 'b, 'c) t -> ('d -> 'e) -> 'f

with_context cm f runs f in the context manager cm

val let< : ('a, 'b, 'c) t -> ('a -> 'b) -> 'c

Let-syntax for with_context

val temp_file : ?temp_dir:string -> string -> string -> (string, 'a, 'b) t

As per Filename.temp_file. Removes the temporary file upon completion.

val openfile : +Ctx_util (less-power.Common.Ctx_util)

Module Common.Ctx_util

Context managers, loosely inspired by Python

type ('a, 'b, 'c) t = + ('a -> ('b, Util.exn_info) Stdlib.result) -> + ('c, Util.exn_info) Stdlib.result

A context manager of type ('a, 'b, 'c) t takes a continuation, and should feed the continuation a value of type 'a. Once the continuation returns with either a Ok of 'b or an exn_info, the continuation should perform cleanup, and may suppress the exception by producing a suitable result (of type 'c) instead. Often, 'b = 'c.

This representation has the advantage that some existing functions library already implement this type (e.g. In_channel.with_open_text).

val with_context : ('a, 'b, 'c) t -> ('d -> 'e) -> 'f

with_context cm f runs f in the context manager cm

module Syntax : sig ... end
val temp_file : ?temp_dir:string -> string -> string -> (string, 'a, 'b) t

As per Filename.temp_file. Removes the temporary file upon completion.

val openfile : string -> Unix.open_flag list -> Unix.file_perm -> @@ -11,7 +11,7 @@ (unit, 'a, 'b option) t
val timed : (unit, 'a, 'b * Mtime.span) t
val capture_exceptions : ?filter:(exn -> bool) -> unit -> - (unit, 'a, ('b, exn_info) Stdlib.result) t
val empty_context : 'a -> ('b -> 'c) -> ('d, 'e, 'f) t
val empty_context' : 'a -> ('b, 'c, 'd) t
val optional_context : + (unit, 'a, ('b, Util.exn_info) Stdlib.result) t
val empty_context : 'a -> ('b -> 'c) -> ('d, 'e, 'f) t
val empty_context' : 'a -> ('b, 'c, 'd) t
val optional_context : some:('a -> ('b, 'c, 'd) t) -> 'e -> ('c -> 'd) -> diff --git a/stdlib-variants-structure/less-power/Common/Util/index.html b/stdlib-variants-structure/less-power/Common/Util/index.html index 1a07fc9..1f9038d 100644 --- a/stdlib-variants-structure/less-power/Common/Util/index.html +++ b/stdlib-variants-structure/less-power/Common/Util/index.html @@ -20,7 +20,7 @@ ('a option -> 'b option) -> 'c -> ('d * 'e) list -> - ('d * 'e) list
val or_option : 'a option -> 'b option -> 'b option
val filter_option : ('a -> bool) -> 'b option -> 'c option
val if_option : bool -> 'a -> 'b option
val string_contains : needle:string -> string -> bool

string_contains ~needle haystack: does needle exist as a substring of haystack? Naive \mathcal{O}(nm) implementation.

val (~$) : 'a -> ('a -> 'b) -> 'b

(~$ x) f is f x, e.g.: List.map (~$ 2) [List.nth ["a"; "b"; "c"]; String.sub "def" 1] returns ["c"; "ef"]

val try_to_result : ('a -> 'b) -> 'c -> ('d, exn) Stdlib.result
val unresult_exn : ('a, exn) Stdlib.result -> 'b
val run_main : (string -> string list -> int) -> 'a

Timeouts

val min_span : Mtime.span -> Mtime.span -> Mtime.span
exception Timeout
val span_to_float_s : Mtime.span -> float

Can overflow for large t

val timeout_unix : + ('d * 'e) list
val or_option : 'a option -> 'b option -> 'b option
val filter_option : ('a -> bool) -> 'b option -> 'c option
val if_option : bool -> 'a -> 'b option
val string_contains : needle:string -> string -> bool

string_contains ~needle haystack: does needle exist as a substring of haystack? Naive \mathcal{O}(nm) implementation.

val (~$) : 'a -> ('a -> 'b) -> 'b

(~$ x) f is f x, e.g.: List.map (~$ 2) [List.nth ["a"; "b"; "c"]; String.sub "def" 1] returns ["c"; "ef"]

type exn_info = {
  1. exn : exn;
  2. backtrace : Stdlib.Printexc.raw_backtrace;
}

Exception and its associated (raw) backtrace.

val raise_exn_info : exn_info -> 'a
val try_to_result : ('a -> 'b) -> 'c -> ('d, exn_info) Stdlib.result
val unresult_exn : ('a, exn_info) Stdlib.result -> 'b
val run_main : (string -> string list -> int) -> 'a

Timeouts

val min_span : Mtime.span -> Mtime.span -> Mtime.span
exception Timeout
val span_to_float_s : Mtime.span -> float

Can overflow for large t

val timeout_unix : ?timer:Unix.interval_timer -> Mtime.span -> ('a -> 'b) -> diff --git a/stdlib-variants-structure/less-power/Test_runner/Std_task/index.html b/stdlib-variants-structure/less-power/Test_runner/Std_task/index.html index 2db3413..931058d 100644 --- a/stdlib-variants-structure/less-power/Test_runner/Std_task/index.html +++ b/stdlib-variants-structure/less-power/Test_runner/Std_task/index.html @@ -87,9 +87,10 @@ ('a, unit) Task.tree

Run something in the tests/ directory with dune exec.

This task passes the --no-build flag to dune. As such:

  • The executable must be built before running this task (e.g. with std_build1).
  • There is no risk of showing the build output to the student.

If phase is given, sets a timeout.

val std_build : cfg -> (unit, unit) Task.tree

Build the assignment library and test binary.

val std_exec_test : cfg -> ?env:(string * string) list -> + ?shards:int option -> output_junit_file:string -> string -> - (unit, unit) Task.tree

Run a test executable in the standard setup. See the note about building first in std_exec1. Assumes the test executable is configured to exit immediately if no command line arguments are passed. We use this to check that the top level code of the submission does not contain any long-running code. If it does, there's no point in running the tests, since the significantly longer test timeout will just kill them. We don't want to prohibit top-level code entirely, since it would prevent things like let impl0 = impl 0.

Thus, first runs the given executable without any arguments, then runs it a second time, with the given output_junit_file (interpreted relative to the test-reports/ directory) as the output JUnit file.

val std_output_junit_file : string
val std_grading_junit_file : string
val std_test : cfg -> (unit, unit) Task.tree

As std_exec_test, fixed to test/test.exe with output to test-reports/results.xml.

val std_exec_process_results : string list -> cfg -> ('a, unit) Task.tree

Run an executable that processes the test results in the standard setup. Executes test/process_results.exe. See the note about building first in std_exec1.

The given file names are taken relative to the test-reports/ directory and passed to the executable.

val std_process_results : + (unit, unit) Task.tree

Run a test executable in the standard setup. See the note about building first in std_exec1. Assumes the test executable is configured to exit immediately if no command line arguments are passed. We use this to check that the top level code of the submission does not contain any long-running code. If it does, there's no point in running the tests, since the significantly longer test timeout will just kill them. We don't want to prohibit top-level code entirely, since it would prevent things like let impl0 = impl 0.

Thus, first runs the given executable without any arguments, then runs it a second time, with the given output_junit_file (interpreted relative to the test-reports/ directory) as the output JUnit file.

val std_output_junit_file : string
val std_grading_junit_file : string
val std_test : ?shards:int option -> cfg -> (unit, unit) Task.tree

As std_exec_test, fixed to test/test.exe with output to test-reports/results.xml.

val std_exec_process_results : string list -> cfg -> ('a, unit) Task.tree

Run an executable that processes the test results in the standard setup. Executes test/process_results.exe. See the note about building first in std_exec1.

The given file names are taken relative to the test-reports/ directory and passed to the executable.

val std_process_results : ?grading:bool -> ?output_junit_files:string list -> cfg ->