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

Confusing error when combining vector and non-vector monads #194

Closed
codahale opened this issue Mar 28, 2017 · 1 comment
Closed

Confusing error when combining vector and non-vector monads #194

codahale opened this issue Mar 28, 2017 · 1 comment

Comments

@codahale
Copy link

I have code which looks like this:

(use '[cats.builtin])
(mlet [a (just 10)
       b [1 2 3 4]]
      (return (+ a b)))

But throws this error

No implementation of method: :-repr of protocol: #'cats.protocols/Printable
   found for class: clojure.lang.PersistentVector

          core_deftype.clj:  568  clojure.core/-cache-protocol-fn
          core_deftype.clj:  560  clojure.core/-cache-protocol-fn
            protocols.cljc:   43  cats.protocols$eval23741$fn__23742$G__23732__23747/invoke
                maybe.cljc:  208  cats.monad.maybe$reify__24200/_mbind
                 core.cljc:   94  cats.core$bind/invokeStatic
                 core.cljc:   81  cats.core$bind/invoke

According to the docs, vector is (once builtin is required) a traversable. Am I holding it wrong, or is this a bug? Appreciate any help here.

@niwinz
Copy link
Member

niwinz commented Apr 20, 2017

Hmm, the error is strange, but in any case, mixing monads in one mlet is not recommeded. In some cases it can work but it is not a way to go.

@niwinz niwinz closed this as completed Apr 20, 2017
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