Map
too.
Promise
s at all?
while (args.length > 0 && !args[0].done)
while (args.length > 0 && !args.every(prop('done')))
every
over each iteration, it could be refactored to something like:function chainRec(f, x) {
var next = function(x) { return {value: x, done: false}; };
var done = function(x) { return {value: x, done: true}; };
var out = [];
var todo = [x];
while (todo.length > 0) {
var xs = f(next, done, todo.shift());
var partitioned = xs.reduce(function(acc, x) {
var bucket = x.done ? acc[1] : acc[0];
bucket.push(x.value);
return acc;
}, [[], []]);
todo.unshift.apply(todo, partitioned[0]);
out.push.apply(out, partitioned[1]);
}
return out;
}
forever
which will repeatedly run the same action sequentially for any given ChainRec
.const forever = m =>
chainRec((next, _, _) => m.map(_ => next(void 0)), void 0);
sanctuary
tag on Stack Overflow. You may like to subscribe to it. Also, I posted a question: Custom equality semantics for Immutable.js data structures. I'd love to be able to use maps and sets when working with Sanctuary, but for various reasons neither the native types nor the Immutable.js equivalents are currently suitable.
generate
script which builds the Sanctuary website is one example of handling errors with the Either type, @btbvoy. For DB interactions one could use a library such as Fluture. The only large project I'm aware of that makes heavy use of Sanctuary is not open source, but reading this blog post will give you an idea of how I used Ramda and Sanctuary in that project.
sequence
to traverse
. I think I'll .skip
those tests and ask @scott-christopher for assistance. One question is whether Maybe#fantasy-land/map
should replace Maybe#map
or whether we should have both. What's your opinion on this, Brad?