Coder Social home page Coder Social logo

ppx_make's Introduction

[@@deriving make]

OCaml CI GitHub release status Coverage Status

[@@deriving] plugin to generate make functions.

Installation

ppx_make can be installed via OCaml Package Manager.

$ opam install ppx_make

Usage

Please see the documentation.

Example

type my_type = {
  my_field : int;
  my_option : int option;
  my_list : int list;
  my_string : string;
  my_default : int; [@default 1024]
}
[@@deriving make]

(* the deriver will automatically generate the function below *)
val make_my_type :
  my_field:int ->
  ?my_option:int ->
  ?my_list:int list ->
  ?my_string:string ->
  ?my_default:int ->
  unit ->
  my_type

ppx_make's People

Contributors

bn-d avatar davesnx avatar kit-ty-kate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kit-ty-kate

ppx_make's Issues

Make this part of a bundle of standard derivers on ocaml-ppx

Hi @bn-d, I've just come across this project and it looks really nice! Do you know about our efforts of writing a bundle of Ppxlib.Deriving standard derivers similar to the old ppx_deriving.std? With "us" I mean the ppxlib team (I'm one of the maintainers). And the person who's doing the work of implementing the derivers is @ayc9 who is doing an Outreachy internship with the OCaml community.

Unfortunately, we didn't know about your ppx_make project some weeks ago when @ayc9 started the internship and started implementing something quite similar to this. So, since this is on me: apologies to both of you!! Now that I know about this project, I have a couple of questions for you:

Would you mind listing the difference(s) with ppx_deriving.make from a user's perspective? E.g. it seems like ppx_make also supports tuples. Are there also some breaking differences?

And what do you think about the idea of joining efforts? @ayc9's work so far has been really good so we for sure want to use it. But still, parts of the implementation of ppx_make would probably still be helpful for us. Of course, if we join efforts, we'll give you credits on our README and let you review @ayc9's version (if you want to) etc.

Breaks on mutually recursive types

More or less the same problem (or perhaps just a limitation?) reported at ocaml-ppx/ppx_deriving#272 affects this library.

module Ex = struct
  type t = {a : int; b: s}
  [@@deriving make]

  and s = int
end

Fails with

File "ex.ml", line 5, characters 6-7:
5 |   and s = int
          ^
Error: core type s cannot be derived

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.