a library for serialization in OCaml
- OCaml 97.1%
- Dune 1.6%
- Nix 1.3%
| lib | ||
| test | ||
| .gitignore | ||
| .ocamlformat | ||
| dune-project | ||
| facade-msgpck.opam | ||
| facade-yojson.opam | ||
| facade.opam | ||
| README.md | ||
| shell.nix | ||
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