package yocaml_unix

  1. Overview
  2. Docs
On This Page
  1. API
  2. Runtime
Legend:
Library
Module
Module type
Parameter
Class
Class type

A runtime describes the set of "low-level" primitives to operate in a specific context. This separation allows to have a pure and platform agnostic kernel (the Yocaml module) and to define specific runtimes as needed. Here is the runtime for UNIXish (OSX/Linux).

API

val execute : 'a Yocaml.Effect.t -> 'a

Executes a YOCaml program using the UNIX Runtime.

val serve : filepath:string -> port:int -> unit Yocaml.t -> unit Lwt.t

serve ~filepath ~port engine will serve, a bit like the sad python server, a static directory ... in addition, the function takes an OCaml program and re-executes it on every HTTP request that does not point to a 404. Very handy for continuous content development!

Runtime

Inclusion of the runtime to be able to use Yocaml_unix as runtime directly.

include Yocaml.Runtime.RUNTIME with type 'a t = 'a
type !'a0 t = 'a
val bind : 'a t -> ('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val get_time : unit -> float t
val file_exists : Yocaml__.Filepath.t -> bool t
val target_exists : Yocaml__.Filepath.t -> bool t
val is_directory : Yocaml__.Filepath.t -> bool t
val get_modification_time : Yocaml__.Filepath.t -> int Yocaml__.Try.t t
val target_modification_time : Yocaml__.Filepath.t -> int Yocaml__.Try.t t
val read_file : Yocaml__.Filepath.t -> string Yocaml__.Try.t t
val content_changes : Yocaml__.Filepath.t -> string -> bool Yocaml__.Try.t t
val write_file : Yocaml__.Filepath.t -> string -> unit Yocaml__.Try.t t
val read_dir : Yocaml__.Filepath.t -> Yocaml__.Filepath.t list t
val create_dir : ?file_perm:int -> Yocaml__.Filepath.t -> unit t
val log : Yocaml__.Log.level -> string -> unit t
val command : string -> int t
OCaml

Innovation. Community. Security.