Reasonml await
Last active
June 5, 2019 17:15
-
-
Save hew/1434b12a5fc077ae142b9b05f265fdea to your computer and use it in GitHub Desktop.
Reasonml Await
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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