Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
map(f) {
return Seq(map(f, this.seq()))
},
// :: Concurrent f a ~> Concurrent f (a -> b) -> Concurrent f b
const fn = stack.pop()
focus = fn(focus.a)
}
if (Pure.is(focus)) {
return of(T, done(focus.a))
}
while (Roll.is(focus)) {
// We are mutating `stack` for performance reasons but it's not
// an issue as it's not an observable side effects 8-)
// If we wanted to do same in a staticly typed language,
// some kind of efficient type aligned sequnce should be used.
stack.push(focus.y)
focus = focus.x
}
// here `focus` must be `Lift`
return map((v) => {
if (stack.length === 0) {
return done(v)
}
const fn = stack.pop()
const nextFocus = fn(v)
return next({ focus: nextFocus, stack })
}, f(focus.i))
}, { focus: this, stack: [] })
},
List.prototype[FL.ap] = function(other) {
return this.isNil || other.isNil ?
Nil :
Z.concat (Z.map (other.head, this), Z.ap (other.tail, this));
};
List.prototype[FL.traverse] = function(typeRep, f) {
return this.isNil ?
Z.of (typeRep, Nil) :
Z.ap (Z.map (Cons, f (this.head)), Z.traverse (typeRep, f, this.tail));
};
List.prototype[FL.map] = function(f) {
return this.isNil ?
Nil :
Cons (f (this.head)) (Z.map (f, this.tail));
};
function map$mapper(mapper, m){
if(!Z.Functor.test(m)) throwInvalidArgument('Future.map', 1, 'be a Functor', m);
return Z.map(mapper, m);
}
S.lift4 = S.curry4 ((fn, a1, a2, a3, a4) => Z.ap (Z.ap (Z.ap (Z.map (fn, a1), a2), a3), a4));
S.eitherToFuture = S.either (Future.reject) (Future.of);
return chain(f => map(f, this), mf)
},
return chain(f => map(f, this), mf)
},