Closed Raynos closed 11 years ago
I'll do this in a branch for exploration. Can fantasy-land provide some code to help here? For example, a simple program that performs some abstract operations over the monad interface, where I can just plug an avow promise in and see it work?
Closed by e9e3725
Does this work for a promise containing a promise ? or will that get flattened out?
Yeah, of(x)
uses x
verbatim as the fulfillment value. For example:
avow.of(avow.of(123)).then(function(p) { console.log(typeof p.then === 'function'); });
However, I didn't change the flattening behavior of then()
.
That's ok. x.then(function (xValue) { return Promise.of(xValue) })
should correctly be "equivelant" to x
. It's supposed to flatten one layer.
Of course x.then(function (xValue) { return Promise.of(Promise.of(xValue)) })
should be "equivelant" to Promise.of(x)
As per https://github.com/promises-aplus/resolvers-spec/issues/24 and https://github.com/pufuwozu/fantasy-land#constructorof-method
Should be pretty simple and then you'll have compliance