package alba
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=439b1dce07c86e914d1ebf1712c5581418314b0c8d13594f27a698b1d25fe272
    
    
  md5=5cf58d4ed4eacbe6f330e9d2378ef5c6
    
    
  doc/alba.fmlib/Fmlib/Io/Output/argument-1-Io/index.html
Parameter Output.Io
module M : Module_types.MONADinclude Module_types.MONAD
val return : 'a -> 'a treturn a makes a monadic container containing the value a.
m >>= f extracts the value a from the monadic container m and returns f a.
f >=> g composition of the two monadic functions f and g.
f >=> g is equivalent to fun a -> f a >>= g.
map f m maps the values in the monadic container m with the function f.
module Path : sig ... endmodule Process : sig ... endmodule Directory : sig ... endmodule File : sig ... endmodule Stdout : sig ... endWrite to standard output (usually the screen).
module Stderr : sig ... endWrite to standard error (usually the screen).
cli_loop state prompt next stop runs a cli loop which starts in state state and prompts its users with the string returned by prompt state. If prompt state returns None, the cli_loop is ended.
If the user enters a line, the command next state line is performed.
If prompt state returns None or the user ends its input by pressing ctrl-d, the command stop state is performed.
Example:
The following command starts a cli_loop and prompts the user at most 5 times with i>  and echoes back the input of the user.
    cli_loop
        0
        (fun i ->
            if i < 5 then
                Some (string_of_int i ^ "> ")
            else
                None)
        (fun i line ->
            Stdout.line line >>= fun _ -> return (i + 1))
        (fun _ -> return ())