package quickterface

  1. Overview
  2. Docs
Quick-to-program app interfaces in OCaml for terminal and web

Install

dune-project
 Dependency

Authors

Maintainers

Sources

quickterface-0.1.0.tbz
sha256=8261e3819564fb5d05f1f313e62b73382152591d7a4349ae5b1b08a4fc2469f3
sha512=e739a971bb0e696ab716c168419c59a3d195922d2d1e4963106a845e3442ffa085b05106f36cceeec9b806bf7d6ef2c31e98db04911fbf73c5ac0ce626449d0f

doc/src/quickterface/io.ml.html

Source file io.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
open! Core

module Input = struct
  type (_, _) t =
    | Text : (string option, string) t
    | Integer : (unit, int) t
    | Single_selection : ('a list * ('a -> string), 'a) t
    | Multi_selection : ('a list * ('a -> string), 'a list) t
end

module Output = struct
  type (_, _) t =
    | Text : (Output_text_options.t, string) t
    | Math : (Output_text_options.t, Math.t) t
    | Title : (unit, string) t
end

module type S = sig
  type t

  module Http_client : Cohttp_lwt.S.Client

  val input : t -> ('settings, 'a) Input.t -> 'settings -> unit -> 'a Lwt.t
  val input_text : ?prompt:string -> t -> unit -> string Lwt.t
  val input_integer : t -> unit -> int Lwt.t

  val input_single_selection :
    t -> 'a list -> ('a -> string) -> unit -> 'a Lwt.t

  val input_single_selection_string : t -> string list -> unit -> string Lwt.t

  val input_multi_selection :
    t -> 'a list -> ('a -> string) -> unit -> 'a list Lwt.t

  val input_multi_selection_string :
    t -> string list -> unit -> string list Lwt.t

  val output :
    ?options:'options ->
    t ->
    ('options, 'a) Output.t ->
    'a ->
    unit ->
    unit Lwt.t

  val output_text :
    ?options:Output_text_options.t -> t -> string -> unit -> unit Lwt.t

  val output_math :
    ?options:Output_text_options.t -> t -> Math.t -> unit -> unit Lwt.t

  val output_title : t -> string -> unit -> unit Lwt.t

  val with_progress_bar :
    ?label:string ->
    t ->
    maximum:int ->
    f:(increment_progress_bar:(unit -> unit Lwt.t) -> unit -> 'a Lwt.t) ->
    unit ->
    'a Lwt.t
end