Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jun Furuse <jun.furuse@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] [ANN][PATCH+PPX] Curried constructor
Date: Fri, 4 Sep 2015 15:58:52 -0700	[thread overview]
Message-ID: <CAAoLEWsO+vbi3Y6QkmmAwhw-4bR3bDvmjDt-LNi7_0kT3mzkNA@mail.gmail.com> (raw)

Hi,

I wrote  curried-constr patch for OCaml 4.02.3.  It makes variant
constructors usable like functions.

For the type definition

  type t = Foo of int * float

we can write

    Foo   as    (fun (x,y) -> Foo (x,y))

ad

    !Foo  as   (fun x y -> Foo (x,y))


There are two ways to try this extension:  as a compiler modification,
and as a PPX preprocessor:

* opam switch 4.02.3+curried-constr   (as a patched compiler)
* opam install ppx_curried_constr       (as a PPX preprocessor)

Enjoy!

Jun

                 reply	other threads:[~2015-09-04 22:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAoLEWsO+vbi3Y6QkmmAwhw-4bR3bDvmjDt-LNi7_0kT3mzkNA@mail.gmail.com \
    --to=jun.furuse@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox