package savvy

  1. Overview
  2. Docs

Source file json_uri.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
module T = struct
  type t = Uri.t
  let to_yojson uri = `String (Uri.to_string uri)
  let of_yojson = function
    | `String s -> Ok (Uri.of_string s)
    | _ -> Error "expected string for Uri.t"
end

(* This is a fancy way of wrapping our new methods (above) into the Uri module *)
(* Essentially what's happening here is the Uri module is brought into context *)
(* and then our struct above is added to context on top of it and the total is returned *)
include Uri
include T
OCaml

Innovation. Community. Security.