Source

spotxtras / xjson.mli

Full commit
open Spotlib.Spot
open Tiny_json

val ocaml_of_t : Json.t Ocaml_conv.encoder
val t_of_ocaml : Json.t Ocaml_conv.decoder
val parse : string -> [> `Error of [> `Json_parse of exn ] | `Ok of Json.t ]

module Error : sig

  val wrap_json_conv : 
    'a Json_conv.decoder 
    -> Json.t 
    ->  ('a, [> `Json_conv of Json.t Meta_conv.Error.t]) Result.t

  val format : Format.t 
    -> [< `Http of int * 'a
       |  `Curl of int * string
       |  `Json_conv of Json.t Meta_conv.Error.t
       |  `Json_parse of exn
       |  `Other of exn ] 
    -> unit

  val from_Ok :
    [< `Error of [< `Http of int * 'a
                 |  `Curl of int * string
                 |  `Json_conv of Json.t Meta_conv.Error.t
                 |  `Json_parse of exn
                 |  `Other of exn ]
    | `Ok of 'b ] 
    -> 'b
end

val curl_get_and_parse :
  'a Json_conv.decoder 
  -> (Curl.handle -> unit) 
  -> ('a, [> `Http of int * string
          |  `Curl of int * string
          |  `Json_conv of Json.t Meta_conv.Error.t
          |  `Json_parse of exn ]) Result.t