package ppx_fast_pipe
Install
Dune Dependency
Authors
Maintainers
Sources
md5=3e4cf5f2de1b2c077d7708fc566a317a
sha512=afc010dd681f51c44d9d1124160a3adaa9f17352adf18b55c07e76dc842f4abd6f22effb8cf10c2e372145dd5c29dc9912726752fc72ea2d3780cde6e4d93aeb
Description
Pipe first as a syntax transform. Provides a ppx to transform expressions containing the |. (Ocaml) or -> (Reason) operator. Pipes the left side as first argument to the right side.
Example Reason:
/* validateAge(getAge(parseData(person))) */ person ->parseData ->getAge ->validateAge;
/* Some(preprocess(name)); */ name->preprocess->Some;
/* f(a, ~b, ~c) */ a->f(~b, ~c)
Example Ocaml:
(* validateAge (getAge (parseData person)) *) person |. parseData |. getAge |. validateAge
(* Some(preprocess name) *) name |. preprocess |. Some;
(* f a ~b ~c *) a |. f ~b ~c
Published: 14 Nov 2018
README
Fast pipe ppx
Pipe first as a syntax transform. Transforms expressions containing the |.
(Ocaml) or ->
(Reason) operator. Pipes the left side as first argument of the right side.
Reason
/* validateAge(getAge(parseData(person))) */
person
->parseData
->getAge
->validateAge;
/* Some(preprocess(name)); */
name->preprocess->Some;
/* f(a, ~b, ~c) */
a->f(~b, ~c)
Ocaml
(* validateAge (getAge (parseData person)) *)
person
|. parseData
|. getAge
|. validateAge
(* Some(preprocess name) *)
name |. preprocess |. Some;
(*f a ~b ~c *)
a |. f ~b ~c
Usage with Dune
dune
file
(executable
(name hello_world)
(preprocess (pps fast_pipe_ppx))
Reason: implementation of the hello_world.re
file
let () =
1000
->string_of_int
->print_endline;
Ocaml: implementation of the hello_world.ml
file
let () =
1000
|. string_of_int
|. print_endline
Developing:
npm install -g esy
git clone <this-repo>
esy install
esy build
Running Tests:
esy test
Dependencies (4)
-
ocaml-migrate-parsetree
< "2.0.0"
- dune
-
reason
>= "3.3.7"
-
ocaml
>= "4.02" & < "4.08"
Dev Dependencies
None
Used by
None
Conflicts
None