cats
cats copied to clipboard
core/alet works in unexpected way
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.
You are right.