craigfe / ppx_irmin Goto Github PK
View Code? Open in Web Editor NEWOCaml PPX extension for automatically generating Irmin types
License: BSD 2-Clause "Simplified" License
OCaml PPX extension for automatically generating Irmin types
License: BSD 2-Clause "Simplified" License
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
It would be great to support polymorphic variants, if possible ๐
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.