Giter Club home page Giter Club logo

json-derivers's Introduction

json-derivers

This library provides comparison, hashing, and sexp conversion functions for the Yojson.Safe.t and Ezjsonm.t types with a minimal amount of dependencies (only https://github.com/janestreet/base):

Json_derivers.Yojson

type t =
  [ `Assoc of (string * t) list
  | `Bool of bool
  | `Float of float
  | `Int of int
  | `Intlit of string
  | `List of t list
  | `Null
  | `String of string
  | `Tuple of t list
  | `Variant of string * t option ]

val sexp_of_t : t -> Base.Sexp.t
val t_of_sexp : Base.Sexp.t -> t
val compare : t -> t -> int
val hash : t -> int

Json_derivers.Jsonm

type value =
  [ `Null
  | `Bool of bool
  | `Float of float
  | `String of string
  | `A of value list
  | `O of (string * value) list ]

val sexp_of_value : value -> Base.Sexp.t
val value_of_sexp : Base.Sexp.t -> value
val compare : value -> value -> int
val hash : value -> int

type t =
  [ `A of value list
  | `O of (string * value) list ]

val sexp_of_t : t -> Base.Sexp.t
val t_of_sexp : Base.Sexp.t -> t
val compare : t -> t -> int
val hash : t -> int

json-derivers's People

Contributors

rgrinberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lupus leviroth idkjs

json-derivers's Issues

Build failed with `base.v.15.1`

Build failed with ocaml v4.14.0 and base v15.1.

$ opam list ocaml
# Packages matching: (installed | available) & name-match(ocaml)
# Package    # Installed # Synopsis
ocaml.4.12.1 4.14.0      The OCaml compiler (virtual package)
ocaml.4.12.2 4.14.0      The OCaml compiler (virtual package)
ocaml.4.13.0 4.14.0      The OCaml compiler (virtual package)
ocaml.4.13.1 4.14.0      The OCaml compiler (virtual package)
ocaml.4.13.2 4.14.0      The OCaml compiler (virtual package)
ocaml.4.14.0 4.14.0      The OCaml compiler (virtual package)
ocaml.4.14.1 4.14.0      The OCaml compiler (virtual package)

$ opam list base
# Packages matching: (installed | available) & name-match(base)
# Package    # Installed # Synopsis
base.v0.14.0 v0.15.1     Full standard library replacement for OCaml
base.v0.14.1 v0.15.1     Full standard library replacement for OCaml
base.v0.14.2 v0.15.1     Full standard library replacement for OCaml
base.v0.14.3 v0.15.1     Full standard library replacement for OCaml
base.v0.15.0 v0.15.1     Full standard library replacement for OCaml
base.v0.15.1 v0.15.1     Full standard library replacement for OCaml

$ jbuilder subst -n json-derivers
$ jbuilder build -p json-derivers
      ocamlc .json_derivers.objs/json_derivers__Import.{cmi,cmo,cmt}
File "import.ml", line 3, characters 17-30:
3 | module Sexplib = Base__Sexplib
                     ^^^^^^^^^^^^^
Warning 49 [no-cmi-file]: no cmi file was found in path for module Base__Sexplib
    ocamlopt .json_derivers.objs/json_derivers__Import.{cmx,o}
File "import.ml", line 3, characters 17-30:
3 | module Sexplib = Base__Sexplib
                     ^^^^^^^^^^^^^
Warning 49 [no-cmi-file]: no cmi file was found in path for module Base__Sexplib
      ocamlc .json_derivers.objs/json_derivers__Jsonm.{cmo,cmt} (exit 2)
(cd _build/default && /home/puripuri2100/.opam/4.14.0/bin/ocamlc.opt -open Base -g -bin-annot -I .json_derivers.objs -I /home/puripuri2100/.opam/4.14.0/lib/base -I /home/puripuri2100/.opam/4.14.0/lib/base/base_internalhash_types -I /home/puripuri2100/.opam/4.14.0/lib/base/caml -I /home/puripuri2100/.opam/4.14.0/lib/base/shadow_stdlib -I /home/puripuri2100/.opam/4.14.0/lib/sexplib0 -no-alias-deps -open Json_derivers__ -o .json_derivers.objs/json_derivers__Jsonm.cmo -c -impl jsonm.ml)
File "jsonm.ml", line 40, characters 28-42:
40 | let rec __value_of_sexp__ : Sexplib.Sexp.t -> value =
                                 ^^^^^^^^^^^^^^
Error: The module Sexplib is an alias for module Base__Sexplib, which is missing
      ocamlc .json_derivers.objs/json_derivers__Yojson.{cmo,cmt} (exit 2)
(cd _build/default && /home/puripuri2100/.opam/4.14.0/bin/ocamlc.opt -open Base -g -bin-annot -I .json_derivers.objs -I /home/puripuri2100/.opam/4.14.0/lib/base -I /home/puripuri2100/.opam/4.14.0/lib/base/base_internalhash_types -I /home/puripuri2100/.opam/4.14.0/lib/base/caml -I /home/puripuri2100/.opam/4.14.0/lib/base/shadow_stdlib -I /home/puripuri2100/.opam/4.14.0/lib/sexplib0 -no-alias-deps -open Json_derivers__ -o .json_derivers.objs/json_derivers__Yojson.cmo -c -impl yojson.ml)
File "yojson.ml", line 57, characters 24-38:
57 | let rec __t_of_sexp__ : Sexplib.Sexp.t -> t =
                             ^^^^^^^^^^^^^^
Error: The module Sexplib is an alias for module Base__Sexplib, which is missing
    ocamlopt .json_derivers.objs/json_derivers__Jsonm.{cmx,o} (exit 2)
(cd _build/default && /home/puripuri2100/.opam/4.14.0/bin/ocamlopt.opt -open Base -g -I .json_derivers.objs -I /home/puripuri2100/.opam/4.14.0/lib/base -I /home/puripuri2100/.opam/4.14.0/lib/base/base_internalhash_types -I /home/puripuri2100/.opam/4.14.0/lib/base/caml -I /home/puripuri2100/.opam/4.14.0/lib/base/shadow_stdlib -I /home/puripuri2100/.opam/4.14.0/lib/sexplib0 -no-alias-deps -open Json_derivers__ -o .json_derivers.objs/json_derivers__Jsonm.cmx -c -impl jsonm.ml)
File "jsonm.ml", line 40, characters 28-42:
40 | let rec __value_of_sexp__ : Sexplib.Sexp.t -> value =
                                 ^^^^^^^^^^^^^^
Error: The module Sexplib is an alias for module Base__Sexplib, which is missing
    ocamlopt .json_derivers.objs/json_derivers__Yojson.{cmx,o} (exit 2)
(cd _build/default && /home/puripuri2100/.opam/4.14.0/bin/ocamlopt.opt -open Base -g -I .json_derivers.objs -I /home/puripuri2100/.opam/4.14.0/lib/base -I /home/puripuri2100/.opam/4.14.0/lib/base/base_internalhash_types -I /home/puripuri2100/.opam/4.14.0/lib/base/caml -I /home/puripuri2100/.opam/4.14.0/lib/base/shadow_stdlib -I /home/puripuri2100/.opam/4.14.0/lib/sexplib0 -no-alias-deps -open Json_derivers__ -o .json_derivers.objs/json_derivers__Yojson.cmx -c -impl yojson.ml)
File "yojson.ml", line 57, characters 24-38:
57 | let rec __t_of_sexp__ : Sexplib.Sexp.t -> t =
                             ^^^^^^^^^^^^^^
Error: The module Sexplib is an alias for module Base__Sexplib, which is missing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.