Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IwanKaramazow/PipeFirst
Fast pipe, pipe first as a syntax transform
https://github.com/IwanKaramazow/PipeFirst
Last synced: 2 days ago
JSON representation
Fast pipe, pipe first as a syntax transform
- Host: GitHub
- URL: https://github.com/IwanKaramazow/PipeFirst
- Owner: IwanKaramazow
- Created: 2018-11-12T17:55:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T21:40:19.000Z (over 4 years ago)
- Last Synced: 2024-11-10T19:56:25.189Z (6 days ago)
- Language: OCaml
- Size: 31.3 KB
- Stars: 27
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-list - PipeFirst
README
# Pipe First ppx [![Build Status](https://travis-ci.org/IwanKaramazow/PipeFirst.svg?branch=master)](https://travis-ci.org/IwanKaramazow/PipeFirst)
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_
```reason
/* validateAge(getAge(parseData(person))) */
person
->parseData
->getAge
->validateAge;/* Some(preprocess(name)); */
name->preprocess->Some;/* f(a, ~b, ~c) */
a->f(~b, ~c)
```_Ocaml_
```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 ppx_pipe_first))
```Reason: implementation of the `hello_world.re` file
```reason
let () =
1000
->string_of_int
->print_endline;
```Ocaml: implementation of the `hello_world.ml` file
```ocaml
let () =
1000
|. string_of_int
|. print_endline
```## Developing:
```
npm install -g esy
git clone
esy install
esy build
```## Running Tests:
```
esy test
```