According to the Fantasyland spec, `v.ap(u.ap(a.map(f => g => x => f(g(x)))))` must be equivalent to `v.ap(u).ap(a)` [https://github.com/fantasyland/fantasy-land#apply](url) . I am using fantasy-io.js and trying to run the following tests: ``` const log = msg => x => { console.log(msg, x); return x; }; const v = IO.of('v'); const u = IO.of(x => `u(${x})`); const a = IO.of(x => `a(${x})`); const testA = v.ap(u.ap(a.map(f => g => x => f(g(x))))) .map(log('testA = ')) .unsafePerform(); const testB = v.ap(u).ap(a) .map(log('testB = ')) .unsafePerform(); ``` The result is: `TypeError: f is not a function` on the line that says `const testA = v.ap(u.ap(a.map(f => g => x => f(g(x)))))` When I swap `a` and `this` in the body of the function `IO.prototype.ap`, the tests succeed: ``` testA = a(u(v)) testB = a(u(v)) ```
According to the Fantasyland spec,
v.ap(u.ap(a.map(f => g => x => f(g(x)))))must be equivalent tov.ap(u).ap(a)https://github.com/fantasyland/fantasy-land#apply .I am using fantasy-io.js and trying to run the following tests:
The result is:
TypeError: f is not a functionon the line that saysconst testA = v.ap(u.ap(a.map(f => g => x => f(g(x)))))When I swap
aandthisin the body of the functionIO.prototype.ap, the tests succeed: