Skip to content

Instantly share code, notes, and snippets.

@hew
Last active June 5, 2019 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hew/1434b12a5fc077ae142b9b05f265fdea to your computer and use it in GitHub Desktop.
Save hew/1434b12a5fc077ae142b9b05f265fdea to your computer and use it in GitHub Desktop.
Reasonml Await

Reasonml await

module Await = {
let let_ = (promise, continuation) =>
promise
>>= (v => Belt.Result.Ok(v) |> continuation |> return)
>>| (
v =>
{
Js.log(v);
Belt.Result.Error(v |> Js.String.make);
}
|> continuation
|> return
)
|> ignore;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment