funcool / funcool/cats

>=> returns a function

Open
#180 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
970
Forks
68
PR merge metrics
No merged PRs in 30d

Description

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)
=> #
(>=> maybe/just maybe/just 0)
=> #
```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two snippets and locating the current >= > implementation in the Cats source. Compare its behavior with the alternative implementation and the linked Haskell reference; done means both the curried and three-argument forms return Just 0 without an arity error.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.