Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function defAvailableMethods(Constructor) {
const result = []
if (Constructor[$.of]) result.push('of')
if (Constructor[$.empty]) result.push('empty')
if (Constructor[$.chainRec]) result.push('chainRec')
if (Constructor[$.zero]) result.push('zero')
if (Constructor.prototype[$.equals]) result.push('equals')
if (Constructor.prototype[$.map]) result.push('map')
if (Constructor.prototype[$.bimap]) result.push('bimap')
if (Constructor.prototype[$.promap]) result.push('promap')
if (Constructor.prototype[$.concat]) result.push('concat')
if (Constructor.prototype[$.ap]) result.push('ap')
if (Constructor.prototype[$.alt]) result.push('alt')
if (Constructor.prototype[$.reduce]) result.push('reduce')
if (Constructor.prototype[$.traverse]) result.push('traverse')
if (Constructor.prototype[$.chain]) result.push('chain')
if (Constructor.prototype[$.extend]) result.push('extend')
if (Constructor.prototype[$.extract]) result.push('extract')
return result
}
function makeFLCompatible(constructor: any) {
constructor.prototype[fl.of] = constructor[fl.of] = constructor.of
constructor.prototype[fl.empty] = constructor[fl.empty] = constructor.empty
constructor.prototype[fl.chainRec] = constructor[fl.chainRec] = constructor.chainRec
constructor.prototype[fl.concat] = constructor.prototype.concat
constructor.prototype[fl.map] = constructor.prototype.map
constructor.prototype[fl.bimap] = constructor.prototype.bimap
constructor.prototype[fl.ap] = constructor.prototype.ap
constructor.prototype[fl.chain] = constructor.prototype.chain
}
static [fl.of] (x) {
return fulfill(x)
}
finally (f) {
return typeof f === 'function'
? _finally(resolve, f, this.near(), new Future())
: this
}
[fl.map] (f) {
return this.map(f)
}
[fl.bimap] (r, f) {
return this.bimap(r, f)
}
[fl.ap] (pf) {
return pf.ap(this)
}
[fl.chain] (f) {
return this.chain(f)
}
[fl.concat] (p) {
return this.concat(p)
}
[fl.alt] (p) {
const bimap = (fa, fb, t) => t[$.bimap](fa, fb)
const promap = (fa, fb, t) => t[$.promap](fa, fb)