Module Core_kernel.Sexp
Code for managing s-expressions.
type t= Base.Sexp.t=|Atom of Core_kernel__.Import.string|List of t Core_kernel__.Import.list
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerThis function only needs implementation if
texposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the varianttafterwards.
val bin_shape_t : Bin_prot.Shape.tval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.t
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_value
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.t
module O : sig ... endinclude Comparable.S with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable.S
include Base__.Comparable_intf.Polymorphic_compare
val ascending : t -> t -> intascendingis identical tocompare.descending x y = ascending y x. These are intended to be mnemonic when used likeList.sort ~compare:ascendingandList.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> intval between : t -> low:t -> high:t -> boolbetween t ~low ~highmeanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> tclamp_exn t ~min ~maxreturnst', the closest value totsuch thatbetween t' ~low:min ~high:maxis true.Raises if
not (min <= max).
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
include Base__.Comparable_intf.Validate with type t := t
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
module Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := tmodule Map : Map.S with type Key.t = t with type Key.comparator_witness = comparator_witnessmodule Set : Set.S with type Elt.t = t with type Elt.comparator_witness = comparator_witnessinclude Core_kernel__.Import.Stringable.S with type t := t
include Quickcheckable.S with type t := t
val quickcheck_generator : t Base_quickcheck.Generator.tval quickcheck_observer : t Base_quickcheck.Observer.tval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
include module type of sig ... end with type t := t
type t= Sexplib.Type.t=|Atom of string|List of t listtype bigstring= (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
val compare : t -> t -> intval equal : t -> t -> boolval default_indent : int Stdlib.refval size : t -> int * intval scan_sexp : ?buf:Stdlib.Buffer.t -> Stdlib.Lexing.lexbuf -> tval scan_sexps : ?buf:Stdlib.Buffer.t -> Stdlib.Lexing.lexbuf -> t listval scan_rev_sexps : ?buf:Stdlib.Buffer.t -> Stdlib.Lexing.lexbuf -> t listval scan_sexp_opt : ?buf:Stdlib.Buffer.t -> Stdlib.Lexing.lexbuf -> t optionval scan_iter_sexps : ?buf:Stdlib.Buffer.t -> f:(t -> unit) -> Stdlib.Lexing.lexbuf -> unitval scan_fold_sexps : ?buf:Stdlib.Buffer.t -> f:('a -> t -> 'a) -> init:'a -> Stdlib.Lexing.lexbuf -> 'aval scan_sexps_conv : ?buf:Stdlib.Buffer.t -> f:(t -> 'a) -> Stdlib.Lexing.lexbuf -> 'a list
module Parse_pos = Sexplib__Sexp.Parse_posmodule Cont_state = Sexplib__Sexp.Cont_statetype ('a, 't) parse_result= ('a, 't) Sexplib.Pre_sexp.parse_result=|Done of 't * Parse_pos.t|Cont of Cont_state.t * ('a, 't) parse_funand ('a, 't) parse_fun= pos:int -> len:int -> 'a -> ('a, 't) parse_result
module Annotated = Sexplib__Sexp.Annotatedtype 't parse_state= private 't Sexplib.Pre_sexp.parse_state={parse_pos : Parse_pos.t;}type parse_error= Sexplib.Pre_sexp.parse_error={err_msg : string;parse_state : [ `Annot of Annotated.stack parse_state | `Sexp of t list list parse_state ];}
exceptionParse_error of parse_error
val parse : ?parse_pos:Parse_pos.t -> ?len:int -> string -> (string, t) parse_resultval parse_bigstring : ?parse_pos:Parse_pos.t -> ?len:int -> bigstring -> (bigstring, t) parse_resultval input_sexp : ?parse_pos:Parse_pos.t -> Stdlib.in_channel -> tval input_sexps : ?parse_pos:Parse_pos.t -> ?buf:bytes -> Stdlib.in_channel -> t listval input_rev_sexps : ?parse_pos:Parse_pos.t -> ?buf:bytes -> Stdlib.in_channel -> t listval load_sexp : ?strict:bool -> ?buf:bytes -> string -> tval load_sexps : ?buf:bytes -> string -> t listval load_rev_sexps : ?buf:bytes -> string -> t listval load_sexp_conv : ?strict:bool -> ?buf:bytes -> string -> (t -> 'a) -> 'a Annotated.convval load_sexp_conv_exn : ?strict:bool -> ?buf:bytes -> string -> (t -> 'a) -> 'aval load_sexps_conv : ?buf:bytes -> string -> (t -> 'a) -> 'a Annotated.conv listval load_sexps_conv_exn : ?buf:bytes -> string -> (t -> 'a) -> 'a listval output_hum : Stdlib.out_channel -> t -> unitval output_hum_indent : int -> Stdlib.out_channel -> t -> unitval output_mach : Stdlib.out_channel -> t -> unitval output : Stdlib.out_channel -> t -> unitval save_hum : ?perm:int -> string -> t -> unitval save_mach : ?perm:int -> string -> t -> unitval save : ?perm:int -> string -> t -> unitval save_sexps_hum : ?perm:int -> string -> t list -> unitval save_sexps_mach : ?perm:int -> string -> t list -> unitval save_sexps : ?perm:int -> string -> t list -> unitval pp_hum : Stdlib.Format.formatter -> t -> unitval pp_hum_indent : int -> Stdlib.Format.formatter -> t -> unitval pp_mach : Stdlib.Format.formatter -> t -> unitval pp : Stdlib.Format.formatter -> t -> unit
val of_string : string -> tval of_string_conv : string -> (t -> 'a) -> 'a Annotated.convval of_string_conv_exn : string -> (t -> 'a) -> 'aval of_bigstring : bigstring -> tval of_bigstring_conv : bigstring -> (t -> 'a) -> 'a Annotated.convval of_bigstring_conv_exn : bigstring -> (t -> 'a) -> 'aval to_string_hum : ?indent:int -> t -> stringval to_string_mach : t -> stringval to_string : t -> stringval to_buffer_hum : buf:Stdlib.Buffer.t -> ?indent:int -> t -> unitval to_buffer_mach : buf:Stdlib.Buffer.t -> t -> unitval to_buffer : buf:Stdlib.Buffer.t -> t -> unitval to_buffer_gen : buf:'buffer -> add_char:('buffer -> char -> unit) -> add_string:('buffer -> string -> unit) -> t -> unitval unit : tval is_unit : t -> boolval sexp_of_t : t -> tval t_of_sexp : t -> tval t_sexp_grammar : Sexplib0.Private.Raw_grammar.t
type found=[|`Found|`Pos of int * found]type search_result=[|`Found|`Not_found|`Pos of int * found]
module With_layout = Sexplib__Sexp.With_layoutexceptionOf_sexp_error of Core_kernel__.Import.exn * t
val of_float_style : [ `Underscores | `No_underscores ] Core_kernel__.Import.refval of_int_style : [ `Underscores | `No_underscores ] Core_kernel__.Import.ref
type 'a no_raise= 'ano_raiseis the identity, but by using'a no_raisein a sexpable type, the resulting usesexp_of_no_raiseprotects the conversion of'ato a sexp so that if it fails, one gets a sexp with an error message about the failure, rather than an exception being raised.WARNING: The resulting
no_raise_of_sexpcan still raise.
val bin_shape_no_raise : Bin_prot.Shape.t -> Bin_prot.Shape.tval bin_size_no_raise : 'a Bin_prot.Size.sizer -> 'a no_raise Bin_prot.Size.sizerval bin_write_no_raise : 'a Bin_prot.Write.writer -> 'a no_raise Bin_prot.Write.writerval bin_writer_no_raise : 'a Bin_prot.Type_class.writer -> 'a no_raise Bin_prot.Type_class.writerval bin_read_no_raise : 'a Bin_prot.Read.reader -> 'a no_raise Bin_prot.Read.readerval __bin_read_no_raise__ : 'a Bin_prot.Read.reader -> (Core_kernel__.Import.int -> 'a no_raise) Bin_prot.Read.readerval bin_reader_no_raise : 'a Bin_prot.Type_class.reader -> 'a no_raise Bin_prot.Type_class.readerval bin_no_raise : 'a Bin_prot.Type_class.t -> 'a no_raise Bin_prot.Type_class.tval sexp_of_no_raise : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a no_raise -> Ppx_sexp_conv_lib.Sexp.tval no_raise_of_sexp : (Ppx_sexp_conv_lib.Sexp.t -> 'a) -> Ppx_sexp_conv_lib.Sexp.t -> 'a no_raise
module Sexp_maybe : sig ... endIf
sexp_of_t fails, it returnsErrorrather than raising. You can convert values of this type to and from sexp in processes that can or cannot parse the underlying sexp in any combination and still recover the original value. Also, theErrorcase contains a human-readable description of the error.
module With_text : sig ... endA
With_text.tis a value paired with the full textual representation of its sexp. This is useful for dealing with the case where you want to keep track of a value along with the format of the s-expression it was generated from, which allows you to maintain formatting details, comments, etc.
val of_sexp_allow_extra_fields_recursively : (Base.Sexp.t -> 'a) -> Base.Sexp.t -> 'aof_sexp_allow_extra_fields_recursively of_sexp sexpusesof_sexpto convertsexpto a value, but will not fail if there are any extra fields in a record (even deeply nested records).The implementation uses global state, so it is not thread safe.
module Stable : sig ... end