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 ap(Par.of(f), this)
},
// :: Par f a ~> Par f (a -> b) -> Par f b
const argT = foldArg(argF, f, T)
if (fns.length === 0) {
return argT
}
let fn = fns.pop()
let res = ap(fn.f, argT)
if (fn.length > 1) {
fns.push(Fn(res, fn.length - 1))
continue
}
while (fns.length > 0) {
fn = fns.pop()
res = ap(fn.f, res)
if (fn.length > 1) {
fns.push(Fn(res, fn.length - 1))
break
}
}
if (fns.length === 0) {
return res
}
}
},
// :: Par f a ~> (Ɐ x. f x -> g x) -> Par g a
function ap$mval(mval, mfunc){
if(!Z.Apply.test(mfunc)) throwInvalidArgument('Future.ap', 1, 'be an Apply', mfunc);
return Z.ap(mval, mfunc);
}
if (Ap.is(argF)) {
const lengthInitial = argsF.length
while (Ap.is(argF)) {
argsF.push(argF.x)
argF = argF.f
}
fns.push(Fn(foldArg(argF, f, T), argsF.length - lengthInitial))
continue
}
const argT = foldArg(argF, f, T)
if (fns.length === 0) {
return argT
}
let fn = fns.pop()
let res = ap(fn.f, argT)
if (fn.length > 1) {
fns.push(Fn(res, fn.length - 1))
continue
}
while (fns.length > 0) {
fn = fns.pop()
res = ap(fn.f, res)
if (fn.length > 1) {
fns.push(Fn(res, fn.length - 1))
break
}
}
if (fns.length === 0) {