Coder Social home page Coder Social logo

craigfe / ppx_irmin Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 1.0 109 KB

OCaml PPX extension for automatically generating Irmin types

License: BSD 2-Clause "Simplified" License

OCaml 87.05% PHP 5.48% C++ 6.71% Standard ML 0.76%
ocaml ppx-extension ppx-deriver irmin

ppx_irmin's Issues

User-defined witnesses in Json module are shadowed

Because of the global open of Irmin.Type in the deriver, any user-defined witnesses in a Json module will be shadowed by the Irmin.Type.Json module.

module Json = struct
  include Yojson.Safe
  let t = Irmin.Type.(map string) from_string to_string
end

type bench_data = {
  uuid: Uuidm.t;
  data: Json.t
} [@@deriving irmin]

gives

32 | ..type bench_data = {
33 |     uuid: Uuidm.t;
34 |     data: Json.t
35 |   } [@@deriving irmin]
Error: Unbound value Json.t

Support mutually recursive types

Currently mutually recursive types such as this one are unsupported:

type odd = Odd of even option
and even = Even of odd option [@@deriving irmin]

However, it's possible to encode these types using the mu2 combinator presented by Irmin. We should support deriving such encodings.

Type qualified by structure name not supported

When trying to use ppx_irmin with a type qualified with a structure name I get an error. Here's a simple example to reproduce the error:

module X = struct
  type t = int [@@deriving irmin]
end

type t = X.t [@@deriving irmin]

Here's an example stack trace:

Fatal error: exception (Invalid_argument unsupported)
Raised at file "stdlib.ml", line 34, characters 20-45
Called from file "ppx_irmin/lib/deriver.ml", line 277, characters 23-85
Called from file "src/list.ml", line 333, characters 13-17
Called from file "src/list.ml" (inlined), line 361, characters 15-31
Called from file "src/deriving.ml" (inlined), line 48, characters 32-43
Called from file "src/deriving.ml", line 195, characters 4-89
Called from file "src/list.ml", line 333, characters 13-17
Called from file "src/list.ml" (inlined), line 361, characters 15-31
Called from file "src/deriving.ml" (inlined), line 48, characters 32-43
Called from file "src/deriving.ml", line 199, characters 4-62
Called from file "src/deriving.ml", line 610, characters 6-63
Called from file "src/context_free.ml", line 325, characters 27-66
Called from file "list.ml", line 117, characters 24-34
Called from file "src/context_free.ml", line 563, characters 14-76
Called from file "src/context_free.ml", line 586, characters 23-37
Called from file "src/driver.ml", line 175, characters 17-30
Called from file "src/driver.ml", line 395, characters 16-19
Called from file "list.ml", line 117, characters 24-34
Called from file "src/list0.ml" (inlined), line 22, characters 40-81
Called from file "src/driver.ml", line 385, characters 2-642
Called from file "src/driver.ml", line 466, characters 4-219
Called from file "src/migrate_parsetree_driver.ml", line 249, characters 21-60
Called from file "src/migrate_parsetree_driver.ml", line 255, characters 4-82
Called from file "src/driver.ml", line 853, characters 53-82
Called from file "src/driver.ml", line 1248, characters 6-24
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Re-raised at file "parsing/location.ml", line 494, characters 14-25
Called from file "parsing/location.ml" (inlined), line 499, characters 31-61
Called from file "src/driver.ml", line 1251, characters 4-59

ppx_irmin is otherwise super helpful and allows getting rid of a lot of boilerplate! It would be great to expand the amount of types supported.

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.