https://github.com/cdaringe/ppx_effects
https://github.com/cdaringe/ppx_effects
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cdaringe/ppx_effects
- Owner: cdaringe
- Created: 2021-10-10T20:27:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:33:25.000Z (over 2 years ago)
- Last Synced: 2025-06-24T09:01:53.712Z (12 months ago)
- Language: OCaml
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ppx_effects
Allows one to write effects via concise syntax via ppx:
```ml
try%effect comp on_complete with
| A (input_a, k) -> handle_a input_a k
| B (input_b, k) -> handle_b input_b k
| C (input_c, k) -> handle_c input_c k
```
See a full example in [test/test.ml](./test/test.ml).
## install
🚨 not yet published to opam
`opam install ppx_effects`
## usage
- add `ppx_effects` to your preprocessors, a la
```dune
(executable
(name my_bin)
;...snip...;
(preprocess
(pps ppx_effects)))
```
- use `[%with_effects ]` where each entry is of form `Effect_constructor handler_name`
## warning
this is ppx is WIP. use with caution