Skip to content

Instantly share code, notes, and snippets.

@zhangchiqing
Created November 1, 2016 20:51
Show Gist options
  • Save zhangchiqing/905dcb3b94e6f8351bea751707bf4339 to your computer and use it in GitHub Desktop.
Save zhangchiqing/905dcb3b94e6f8351bea751707bf4339 to your computer and use it in GitHub Desktop.
Maybe Promise a -> Promise Maybe a
var P = require('bluebird-promisell');
var S = require('sanctuary').create({ checkTypes: true, env: require('sanctury').env });
// toPromiseMaybe :: Maybe Promise a -> Promise Maybe a
var toPromiseMaybe = S.maybe(P.purep(S.Nothing()), P.liftp1(S.Just));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment