This repository has been archived by the owner on Jul 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Fantasy-IO does not comply to Fantasyland specs #2
Comments
This lib is outdated, it is supporting old version of fantasy-land |
@nadameu What are you using for the IO monad now? End up writing something? |
It would be better to update this lib then write new one |
@safareli What are you using to model IO? |
@mwalkerwells I usually write my FL implementations from scratch, since I write mostly Greasemonkey scripts, which makes working with libraries (imports/exports) difficult. Also, most implementations have a lot of methods I usually don't need, and I need my code to be lightweight. I like this style: const IO = performUnsafeIO => ({
performUnsafeIO,
ap: a => IO(() => a.performUnsafeIO()(performUnsafeIO())),
chain: f => IO(() => f(performUnsafeIO()).performUnsafeIO()),
map: f => IO(() => f(performUnsafeIO()))
});
IO.of = x => IO(() => x); |
Ah, gotcha. I was also actually thinking of forking to be FL compliant. Any reason you haven't submitted a PR upstream? |
nadameu
added a commit
to nadameu/fantasy-io
that referenced
this issue
Aug 17, 2017
Pull request #3 submitted |
Love it man 👍🏻👍🏻 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 function
on the line that saysconst testA = v.ap(u.ap(a.map(f => g => x => f(g(x)))))
When I swap
a
andthis
in the body of the functionIO.prototype.ap
, the tests succeed:The text was updated successfully, but these errors were encountered: