bucklescript-fluture

0.1.1 • Public • Published

bucklescript-fluture

Bucklescript bindings to 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:

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

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

Package Sidebar

Install

npm i bucklescript-fluture

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

4.13 kB

Total Files

4

Last publish

Collaborators

  • ryloric