Created
June 30, 2020 02:28
-
-
Save lambdaydoty/85ee0026cd288481fa0883ad01b5c2e4 to your computer and use it in GitHub Desktop.
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
;(function () { | |
const { S, F } = require ('./src/utils/sanctuary') () | |
const control = F.coalesce (_ => S.Nothing) (S.Just) | |
const fut = F.go (function * () { | |
// const book1 = yield F.resolve ('Python') | |
const book1 = yield control (F.reject ('?network error')) | |
const book2 = yield control (F.resolve ('JavaScript')) | |
return { | |
book1, | |
book2, | |
} | |
}) | |
const happy = x => console.log ('resolved:', x) | |
const unhappy = x => console.error ('rejected:', x) | |
F.fork (unhappy) (happy) (fut) | |
}) () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment