package ppx_fun
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=f3f58f3d50222d50b255766972d28e48b447dba792f133451e24ff9a1c886bdb
sha512=7f2b887d0e3b3e9efb085f0c144b38a26639209ade7cf0704a0deb7d3a0424e81c07db725147132de3d4c68ff4c4f14118414325e675138e2a82c0c5987aaa72
Description
Ppx rewriter for fun
README
ppx_fun — shorthand syntax for anonymous functions
ppx_fun is PPX rewriter that provides simplified syntax for anonymous functions via extensions: [%f ...] and [%f_ ...].
Examples
(* anonymous placeholder: *)
List.iter lst ~f:[%f Printf.printf "element: %d" __]
(* function translated to: (fun v -> Printf.printf "element: %d" v) *)
(* positional placeholders: *)
List.map lst ~f:[%f _1 * _2]
(* translated to: (fun v1 v2 -> v1 * v2) *)
(* unused positional placeholders: *)
some_func |> [%f _1 ^ _3]
(* translated to: (fun v1 _v2 v3 -> v1 ^ v3) *)
(* 0-ary function: *)
async_func >>= [%f other_async_func var ]
(* translsated to: (fun () -> other_async_func var) *)
(* drop argument: *)
return_smth >>= [%f_ ignore_and_continue ()]
(* translated to*)Note: function parameters are named with line info to avoid name-clashing.
Installation
ppx_fun can be installed with opam:
opam install ppx_funUsage
Add ppx_fun as dependency to your opam file, and this to your _tags:
<src/*.ml>: package(ppx_fun)Differences with ppx_lambda
ppx_lambda is another ppx rewriter with aim to provide lightweight syntax for anonymous functions. With contrast to ppx_lambda, this packages is:
- Maintained %)
- Available via opam
- Uses extension syntax, so no strange conflicts/errors
Build instruction
maketo build rewriter and run tests.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building ppx_fun with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.0.9 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure