dune/src/string_with_vars.mli

39 lines
925 B
OCaml
Raw Normal View History

2016-12-23 15:32:23 +00:00
(** String with variables of the form ${...} or $(...)
Variables cannot contain "${", "$(", ")" or "}". For instance in "$(cat ${x})", only
"${x}" will be considered a variable, the rest is text. *)
2016-12-02 13:54:32 +00:00
open Import
type t
val t : Sexp.t -> t
2017-02-21 17:13:30 +00:00
val sexp_of_t : t -> Sexp.t
2016-12-02 13:54:32 +00:00
val of_string : string -> t
val vars : t -> String_set.t
val fold : t -> init:'a -> f:('a -> string -> 'a) -> 'a
val expand : t -> f:(string -> string option) -> string
module type Container = sig
type 'a t
val t : (Sexp.t -> 'a) -> Sexp.t -> 'a t
2017-02-21 17:13:30 +00:00
val sexp_of_t : ('a -> Sexp.t) -> 'a t -> Sexp.t
2016-12-02 13:54:32 +00:00
val map : 'a t -> f:('a -> 'b) -> 'b t
val fold : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b
end
module Lift(M : Container) : sig
type nonrec t = t M.t
val t : Sexp.t -> t
2017-02-21 17:13:30 +00:00
val sexp_of_t : t -> Sexp.t
2016-12-02 13:54:32 +00:00
val fold : t -> init:'a -> f:('a -> string -> 'a) -> 'a
val expand : t -> f:(string -> string option) -> string M.t
end