Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

<*> throws an exception if the first argument is not a higher-order function #182

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

Comments

@luminusian
Copy link

Currently,

((<*> + inc) 1)
CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn, compiling:

It can be worked around by calling <*> like this:

((<*> (m/curry 2 +) inc) 1)
=> 3

Here is an alternative implementation of -fapply for function-context in cats.builtin

    (-fapply [_ self av]
      (fn [x] (((m/curry 2 self) x) (av x))))

With this implementation,

((<*> + inc) 1)
=> 3

This implementation doesn't work if the first argument of <*> is a higher-order function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant