ptal / expected

What did you expect?
113 stars 18 forks source link

`expected<void, E>` doesn't have an unwrapping overload in `bind`, effectively making `bind` equivalent to map #89

Closed russellmcc closed 8 years ago

viboes commented 8 years ago

What about https://github.com/ptal/expected/blob/master/include/boost/expected/expected.hpp#L1773?

russellmcc commented 8 years ago

If the functor F returns an expected<void, E>, then that overload will return a expected<expected<void, E>, but it should return an expected<void, E>.

If you look at the non-void case, this is handled correctly with 3 different overloads.

viboes commented 8 years ago

I have committed a first fix https://github.com/ptal/expected/commit/c144c9b4eba46afedd1197dda2c45f1a6150faad.

I will add some tests later on and fix the bind interface. Only the new added signature is correct.

viboes commented 8 years ago

https://github.com/ptal/expected/commit/a02e2482386d3aafa6c5eea4f1b3b22875e660ab