This file contains 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 Result = { | |
type result('a, 'b) = | |
| Ok('a) | |
| Error('b); | |
let isOk = (result_) => | |
switch result_ { | |
| Ok(_) => true | |
| Error(_) => false | |
}; | |
let isError = (result_) => |
This file contains 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
let all = Js.Promise.all; | |
let resolve = Js.Promise.resolve; | |
let reject = Js.Promise.reject; | |
let andThen = | |
(p: Js.Promise.t('a), fn: 'a => Js.Promise.t('b)): Js.Promise.t('b) => | |
p->Js.Promise.then_(fn, _); |