package parsexp

  1. Overview
  2. Docs
type 'a single_or_many = 'a
val parse_string : string -> (Sexplib0.Sexp.t -> 'a) -> ('a single_or_many, Conv_error.t) Pervasives.result
val parse_string_exn : string -> (Sexplib0.Sexp.t -> 'a) -> 'a single_or_many
val conv : (Sexplib0.Sexp.t single_or_many * Positions.t) -> (Sexplib0.Sexp.t -> 'a) -> ('a single_or_many, Of_sexp_error.t) Pervasives.result
val conv_combine : (Sexplib0.Sexp.t single_or_many * Positions.t, Parse_error.t) Pervasives.result -> (Sexplib0.Sexp.t -> 'a) -> ('a single_or_many, Conv_error.t) Pervasives.result

Convenience function for merging parsing and conversion errors.

For instance if you have a load function as follow:

val load : string -> (Sexp.t list * Positions.t, Parse_error.t) result

then you can create a load_conv function as follow:

let load_conv : string -> (Sexp.t -> 'a) -> ('a list, Conv_error.t) result
  = fun filename f -> conv_combine (load filename) f
OCaml

Innovation. Community. Security.