Skip to content

Commit

Permalink
doc: more documentation organization
Browse files Browse the repository at this point in the history
  • Loading branch information
sorawee committed Nov 29, 2023
1 parent 7274ee7 commit 033e11f
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions lib/signature.mli
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,23 @@ end

module type PrinterT =
sig
(** The pretty expressive printer inferface.

Examples in the rest of this section assume that the program begins with
type doc
(** The [doc] type *)

type cost
(** The [cost] type *)

(** Examples in the rest of this section assume that the program begins with
{[
open Pretty_expressive
let cf = Printer.default_cost_factory ~page_width:10 ()
module P = Printer.Make (val cf)
open P
]}
*)

type doc
(** The [doc] type *)
]} *)

type cost
(** The [cost] type *)

(** {2 Text document} *)

Expand Down Expand Up @@ -93,30 +92,6 @@ Portal
val hard_nl : doc
(** [hard_nl] is a document for a newline that {!fail}s to {!flatten}. *)

(** {2 Choice document} *)

val (<|>) : doc -> doc -> doc
(** [a <|> b] is a document for a choice between document [a] and [b].
{[
# let print_doc w =
let cf = Printer.default_cost_factory ~page_width:w () in
let module P = Printer.Make (val cf) in
let open P in
pretty_print (text "Chrono Trigger" <|>
(text "Octopath" ^^ nl ^^ text "Traveler")) |> print_endline;;
val print_doc : int -> unit = <fun>
# print_doc 10;;
Octopath
Traveler
- : unit = ()
# print_doc 15;;
Chrono Trigger
- : unit = ()
]}
See also {{!page-index.bestpractice}Best Practice for Document Construction} *)

(** {2 Concatenation document} *)

val (^^) : doc -> doc -> doc
Expand Down Expand Up @@ -151,6 +126,30 @@ FEZ
should not be rigid.
*)

(** {2 Choice document} *)

val (<|>) : doc -> doc -> doc
(** [a <|> b] is a document for a choice between document [a] and [b].
{[
# let print_doc w =
let cf = Printer.default_cost_factory ~page_width:w () in
let module P = Printer.Make (val cf) in
let open P in
pretty_print (text "Chrono Trigger" <|>
(text "Octopath" ^^ nl ^^ text "Traveler")) |> print_endline;;
val print_doc : int -> unit = <fun>
# print_doc 10;;
Octopath
Traveler
- : unit = ()
# print_doc 15;;
Chrono Trigger
- : unit = ()
]}
See also {{!page-index.bestpractice}Best Practice for Document Construction} *)

(** {2 Indentation documents} *)

val align : doc -> doc
Expand Down

0 comments on commit 033e11f

Please sign in to comment.