File: json.ml

package info (click to toggle)
ocaml-multicore-bench 0.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 320 kB
  • sloc: ml: 1,476; sh: 60; makefile: 6
file content (9 lines) | stat: -rw-r--r-- 371 bytes parent folder | download
1
2
3
4
5
6
7
8
9
open Option_ext.Syntax

type t = Yojson.Safe.t

let as_assoc = function `Assoc assoc -> Some assoc | (_ : t) -> None
let prop key = as_assoc >=> List.assoc_opt key
let as_list = function `List list -> Some list | (_ : t) -> None
let as_string = function `String string -> Some string | (_ : t) -> None
let as_float = function `Float float -> Some float | (_ : t) -> None