https://github.com/ryloric/bucklescript-fluture
BuckleScript bindings for fluture-js
https://github.com/ryloric/bucklescript-fluture
bucklescript bucklescript-bindings ocaml reasonml
Last synced: 5 months ago
JSON representation
BuckleScript bindings for fluture-js
- Host: GitHub
- URL: https://github.com/ryloric/bucklescript-fluture
- Owner: ryloric
- Created: 2019-03-27T06:35:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-27T07:31:43.000Z (about 7 years ago)
- Last Synced: 2025-10-03T16:08:08.938Z (9 months ago)
- Topics: bucklescript, bucklescript-bindings, ocaml, reasonml
- Language: OCaml
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bucklescript-fluture
Bucklescript bindings to [fluture-js/Fluture](https://github.com/fluture-js/Fluture)
Currently contains only a small part of fluture's API with the rest added as needed.
## Install
npm instal --save bucklescript-fluture
## Usage
Examples:
```OCaml
let () =
Future.(
10
|> resolve
|> map (fun x -> x + 1)
|> chain (fun x -> resolve (x + 1))
|> fork Js.log Js.log
)
```
Node style callback to Future
```OCaml
module F = Future
external readFile: string -> string -> F.nodeback -> unit = "readFile"[@@bs.module "fs"]
let readFileF: string -> string -> (_, string) F.future = F.encaseN2 readFile
let () =
readFileF "utf-8" "package.json"
|> Future.fork Js.log Js.log
```