Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

<*> does not invoke a function when the third argument is supplied #181

Open
luminusian opened this issue Oct 3, 2016 · 0 comments
Open

Comments

@luminusian
Copy link

Currently,

(m/<*> (fn [_] inc) inc 1)
=>
#object[cats.builtin$reify__1037$fn__1038
        0x5ef84c83
        "cats.builtin$reify__1037$fn__1038@5ef84c83"]
((m/<*> (fn [_] inc) inc) 1)
=> 3

Ideally,

(<*> (fn [_] inc) inc 1)
=> 3

Haskell's definition takes three arguments although it doesn't matter how it's defined in Haskell as it's curried.
https://hackage.haskell.org/package/base-4.9.0.0/docs/src/GHC.Base.html#line-641

In order to accept the third argument, -fppply of cats.builtin's function-context can be modified like this:

    (-fapply [_ self av]
      (if (fn? av)
        (fn [x] ((self x) (av x)))
        (self av)))
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant