Module Ocamlformat_stdlib.ErrorSource
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_compare_lib.Comparable.S__local with type t := t
include Ppx_compare_lib.Equal.S with type t := t
include Ppx_compare_lib.Equal.S__local with type t := t
include Ppx_hash_lib.Hashable.S with type t := t
include Sexplib0.Sexpable.S__stack with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
include Sexplib0.Sexpable.Sexp_of__stack with type t := t
Be careful that the body of the lazy or thunk does not access mutable data, since it will only be called at an undetermined later point.
Note that the exception raised by this function maintains a reference to the t passed in.
Re-raise exceptions raised from f with this t as context. If this function raises, the exception maintains a reference to the t passed in.
include Ppx_compare_lib.Comparable.S__local with type t := t
include Ppx_compare_lib.Equal.S__local with type t := t
include Sexplib0.Sexpable.S__stack with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
include Sexplib0.Sexpable.Sexp_of__stack with type t := t
Explicitly indicate that t_of_sexp produces a portable t. This is nicer for the user: you can do more things with a portable t, e.g. move it between domains.
to_string_hum forces the lazy message, which might be an expensive operation.
to_string_hum usually produces a sexp; however, it is guaranteed that to_string_hum (of_string s) = s.
If this string is going to go into a log file, you may find it useful to ensure that the string is only one line long. To do this, use to_string_mach t.
to_string_mach t outputs t as a sexp on a single line.
Be careful that the body of the lazy or thunk does not access mutable data, since it will only be called at an undetermined later point.
val create :
('a : value_or_null). ?here:Lexing.position ->
?strict:unit ->
string ->
'a ->
('a -> Sexplib0.Sexp.t) ->
t @@ portableFor create message a sexp_of_a, sexp_of_a a is lazily computed, when the info is converted to a sexp. So if a is mutated in the time between the call to create and the sexp conversion, those mutations will be reflected in the sexp. Use ~strict:() to force sexp_of_a a to be computed immediately.
Constructs a t containing only a string from a format. This eagerly constructs the string.
createf_portable format arg1 arg2 ... () is like createf format arg1 arg2 ..., except creating a portable error.
Adds a sexp to the front.
Adds a lazy string to the front.
Adds a portable lazy string to the front.
Adds a lazy sexp to the front.
Adds a portable lazy sexp to the front.
val tag_arg :
('a : value_or_null). t ->
string ->
'a ->
('a -> Sexplib0.Sexp.t) ->
t @@ portableAdds a string and some other data in the form of an s-expression at the front.
of_exn and to_exn are primarily used with Error, but their definitions have to be here because they refer to the underlying representation.
~backtrace:`Get attaches the backtrace for the most recent exception. The same caveats as for Printexc.print_backtrace apply. ~backtrace:(`This s) attaches the backtrace s. The default is no backtrace.
Constructs a portable info out of a possibly non-portable info. This operation is less expensive than err |> sexp_of_t |> create_s, but it's not a no-op.
It's not a no-op because it needs to force any non-portable computation of the input info.
Convert to Portable.t via portabilize.
Unlike the standard to_string_* functions under S, these encode any t that's represented by a sexp 1 using Sexp.Utf8.to_string_*, ensuring that valid UTF-8 sexp atoms get printed as-is. Standard to_string_* functions, by contrast, encode sexps using Sexp.to_string_*, encoding UTF-8 / other non-ASCII characters using escape sequences.