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

>=> returns a function #180

Open
luminusian opened this issue Sep 30, 2016 · 1 comment
Open

>=> returns a function #180

luminusian opened this issue Sep 30, 2016 · 1 comment

Comments

@luminusian
Copy link

luminusian commented Sep 30, 2016

Is this a bug?

((m/>=> maybe/just maybe/just) 0)
CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core/>=>, compiling:
(m/>=> maybe/just maybe/just 0)
=>
#object[cats.builtin$reify__1037$fn__1040
        0x10a68dba
        "cats.builtin$reify__1037$fn__1040@10a68dba"]

Here is an alternative implementation:

(defn >=>
  ([f g]
   (fn [x] (m/>>= (f x) g)))
  ([f g x]
   ((>=> f g) x)))

((>=> maybe/just maybe/just) 0)
=> #<Just 0>
(>=> maybe/just maybe/just 0)
=> #<Just 0>

https://hackage.haskell.org/package/base-4.9.0.0/docs/src/Control.Monad.html#%3E%3D%3E

@luminusian luminusian changed the title >=> returns reify >=> returns a function Oct 4, 2016
@niwinz
Copy link
Member

niwinz commented Apr 20, 2017

Feel free to open a PR for that ;)

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

2 participants