package current_web

  1. Overview
  2. Docs

Source file user.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
type t = {
  id : string;
} [@@deriving yojson]

let v id = Ok { id }

let v_exn id = { id }

let id t = t.id

let marshal t =
  to_yojson t |> Yojson.Safe.to_string

let unmarshal = function
  | "" -> Ok None
  | s -> Yojson.Safe.from_string s |> of_yojson |> Result.map Option.some

let pp f t = Fmt.(quote string) f t.id
OCaml

Innovation. Community. Security.