https://github.com/jaredly/ppx_import
https://github.com/jaredly/ppx_import
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jaredly/ppx_import
- Owner: jaredly
- Created: 2017-08-09T03:26:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T05:28:24.000Z (almost 9 years ago)
- Last Synced: 2025-03-20T16:51:11.158Z (over 1 year ago)
- Language: OCaml
- Size: 7.81 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# ppx_import - javascript-style imports for reason/ocaml
## Why?
This is more concise than doing a ton of lets, and more specific than an `open`.
## What does it look like?
Now you get to
```
[%%import thing][@@from Source1];
[%%import (Sub1, Sub2)][@@from Source2];
[%%import (one, Two.Three ((), four, Five.Six))][@@from Source3];
```
which turns into
```
let thing = Source1.thing;
module Sub1 = Source2.Sub1;
module Sub2 = Source2.Sub2;
let one = Source3.one;
module Three = Source3.Two.Three;
let four = Source3.Two.Three.four;
module Six = Source3.Two.Three.Five.Six;
```
See [test.re](test/test.re) for more examples.