mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
add CCFormat.{const_string,opaque}
This commit is contained in:
parent
25660ee2c1
commit
92aad159c8
2 changed files with 15 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ type 'a iter = ('a -> unit) -> unit
|
|||
include Format
|
||||
|
||||
type t = Format.formatter
|
||||
type 'a printer = t -> 'a -> unit
|
||||
type -'a printer = t -> 'a -> unit
|
||||
|
||||
(** {2 Combinators} *)
|
||||
|
||||
|
|
@ -182,6 +182,9 @@ let some pp out = function
|
|||
| None -> ()
|
||||
| Some x -> pp out x
|
||||
|
||||
let const_string s out _ = string out s
|
||||
let opaque out _ = string out "opaque"
|
||||
|
||||
let lazy_force pp out (lazy x) = pp out x
|
||||
|
||||
let lazy_or ?(default=return "<lazy>") pp out x =
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ include module type of struct include Format end
|
|||
(** {{: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html} Documentation for the standard Format module}*)
|
||||
|
||||
type t = Format.formatter
|
||||
type 'a printer = t -> 'a -> unit
|
||||
type -'a printer = t -> 'a -> unit
|
||||
|
||||
(** {2 Combinators} *)
|
||||
|
||||
|
|
@ -167,6 +167,16 @@ val some : 'a printer -> 'a option printer
|
|||
@since 1.0
|
||||
*)
|
||||
|
||||
val const_string : string -> 'a printer
|
||||
(** [const_string s] is a printer that ignores its input and
|
||||
always prints [s].
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val opaque : 'a printer
|
||||
(** [opaque] is [const_string "opaque"].
|
||||
The exact string used is not stable.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val lazy_force : 'a printer -> 'a lazy_t printer
|
||||
(** [lazy_force pp out x] forces [x] and prints the result with [pp].
|
||||
@since 2.0 *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue