cats icon indicating copy to clipboard operation
cats copied to clipboard

core/alet works in unexpected way

Open s-mage opened this issue 9 years ago • 1 comments

Hi!

Seems like when one of alet args in not wrapped into monad it returns the value of the last of that arg. Better show than explain:

err.core=> (alet [a (ei/right 1) b (inc a)] 42)
2
err.core=> (alet [a (ei/right 1) b (ei/right (inc a))] 42)
#<Right 42>
err.core=> (alet [a (ei/right 1) b (inc a) c (+ b 4)] 42)

IllegalArgumentException No context is set and it can not be automatically resolved from provided value  cats.context/throw-illegal-argument (context.cljc:32)
err.core=> (alet [a (ei/right 1) b (inc a) c (+ a 4)] 42)
2

I think it should raise exception in all that cases.

s-mage avatar Aug 13 '16 07:08 s-mage

You are right.

niwinz avatar Aug 16 '16 05:08 niwinz