a library for serialization in OCaml
  • OCaml 97.1%
  • Dune 1.6%
  • Nix 1.3%
Find a file
2026-05-23 20:25:48 -04:00
lib add shape introspection and option' combinator 2026-05-23 20:25:48 -04:00
test add shape introspection and option' combinator 2026-05-23 20:25:48 -04:00
.gitignore initial commit 2026-05-21 22:28:46 -04:00
.ocamlformat initial commit 2026-05-21 22:28:46 -04:00
dune-project reject duplicate record field names 2026-05-22 11:50:05 -04:00
facade-msgpck.opam reject duplicate record field names 2026-05-22 11:50:05 -04:00
facade-yojson.opam reject duplicate record field names 2026-05-22 11:50:05 -04:00
facade.opam reject duplicate record field names 2026-05-22 11:50:05 -04:00
README.md initial commit 2026-05-21 22:28:46 -04:00
shell.nix * 2026-05-22 16:13:05 -04:00

facade

facade is a library for serialization in OCaml. You describe the shape of your types and get encoding and decoding for free.

type point = { x : int; y : int }

let point_shape =
  Facade.Shape.(
    record (fun x y -> { x; y })
    |> required "x" int (fun p -> p.x)
    |> required "y" int (fun p -> p.y)
    |> seal)

let point_of_json v =
  Facade.decode (module Facade_yojson) point_shape v