Allowing let-binding for functions whose last argument is a closure
  • OCaml 80.2%
  • Dune 13.2%
  • Makefile 6.6%
Find a file
2024-05-13 13:52:53 +02:00
.github/workflows Update janestreet-bleeding url 2024-05-12 19:02:37 +02:00
.vscode init 2023-11-13 17:34:41 +01:00
src init 2023-11-13 17:34:41 +01:00
test Link to letfun 2024-05-13 13:52:53 +02:00
.gitattributes init 2023-11-13 17:34:41 +01:00
.gitignore init 2023-11-13 17:34:41 +01:00
.ocamlformat Upgrade ocamlformat to 0.26.2 2024-04-30 14:49:24 +02:00
CHANGES.md Prepare changelog 2024-03-13 09:54:20 +01:00
dune init 2023-11-13 17:34:41 +01:00
dune-project Upgrade dune & dune libs to 3.15 2024-04-10 15:02:54 +02:00
LICENSE init 2023-11-13 17:34:41 +01:00
Makefile init 2023-11-13 17:34:41 +01:00
ppx-let-fun.opam Upgrade dune & dune libs to 3.15 2024-04-10 15:02:54 +02:00
README.md Link to letfun 2024-05-13 13:52:53 +02:00

ppx-let-fun

CI Status

ppx-let-fun is an experimental ppx rewriter which allows you to use a let-syntax style to handle functions applications that expects their last argument to be a closure. It defines and rewrite the let%fun extension:

For example:

let print_hello_world file =
  Out_channel.with_open_text file (fun oc ->
    Out_channel.output_string oc "Hello, ";
    Out_channel.output_string oc "World\n")

Can be rewritten as:

let print_hello_world file =
  let%fun oc = Out_channel.with_open_text file in
  Out_channel.output_string oc "Hello, ";
  Out_channel.output_string oc "World\n"

Archived

I'm now considering using a let& operator instead:

let print_hello_world file =
  let& oc = Out_channel.with_open_text file in
  Out_channel.output_string oc "Hello, ";
  Out_channel.output_string oc "World\n"

which I have released as an alternative library named letfun.

As a result, ppx-let-fun is now archived and I will not continue supporting it.