package yocaml_eio

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Rexports Runtime to be used outside of the package.

include Yocaml.Required.RUNTIME with type 'a t = Eio_unix.Stdenv.base -> 'a
type runtime_error

Runtime errors can be defined by the runtime creator.

type 'a t = Eio_unix.Stdenv.base -> 'a

Each command is wrapped in a value of type 'a t, making it possible to build runtimes wrapped in monads (for example, Git/Irmin, which are currently based on Lwt).

val runtime_error_to_string : runtime_error -> string

Converts a runtime error into a character string for diagnosis.

val bind : ('a -> 'b t) -> 'a t -> 'b t

the bind primitive for t.

val return : 'a -> 'a t

the return primitive for t.

val log : [ `App | `Error | `Warning | `Info | `Debug ] -> string -> unit t

log level message log a message with a given message.

val get_time : unit -> int t

get_time () returns the current timestamp.

val file_exists : on:[ `Source | `Target ] -> Yocaml.Path.t -> bool t

file_exists ~on:source -> path returns true if the file exists, false otherwise.

val read_file : on:[ `Source | `Target ] -> Yocaml.Path.t -> (string, runtime_error) Stdlib.result t

read_file ~on:source -> path returns the content of a file.

val get_mtime : on:[ `Source | `Target ] -> Yocaml.Path.t -> (int, runtime_error) Stdlib.result t

get_mtime ~on:source path returns the modification time of a file.

val hash_content : string -> string t

hash_content str hash a content.

val create_directory : on:[ `Source | `Target ] -> Yocaml.Path.t -> (unit, runtime_error) Stdlib.result t

create_directory ~on path create a directory.

val write_file : on:[ `Source | `Target ] -> Yocaml.Path.t -> string -> (unit, runtime_error) Stdlib.result t

write_file ~on:source path content write a file.

val is_directory : on:[ `Source | `Target ] -> Yocaml.Path.t -> bool t

is_directory ~on:source path returns true if the given path is a directory, false otherwise.

val read_dir : on:[ `Source | `Target ] -> Yocaml.Path.t -> (Yocaml.Path.fragment list, runtime_error) Stdlib.result t

read_dir ~on:source path returns a list of filename (fragment) of a given directory.

val exec : ?is_success:(int -> bool) -> string -> string list -> (string, runtime_error) Stdlib.result t

exec ?is_success prog ?args will executes prog ...args. When is_success is provided, it is called with the exit code to determine whether it indicates success or failure. Without is_success, success requires the process to return an exit code of 0.

printing on standard output is returned.

val to_eio_path : Eio_unix.Stdenv.base -> Yocaml.Path.t -> Eio.Fs.dir_ty Eio.Path.t

An helper for converting Yocaml.Path.t to Eio.Path.t.

OCaml

Innovation. Community. Security.