Re:Mental models around Ok-Wrapping
by bcheung on Friday April 10, 2020 @01:48PM
(#22835390)
The number of variables doesn't matter, as long as they are the same type is the part that matters.
<T, E> can be thought of as a pair, tuple, cartesian product. Likewise you can expand it to as many values as you want.
If type C is just (T, E) then it is really just Result<C> at that point.
The first T can vary but as long as everything after that is fixed to the same type, you can have as many variables/types as you want and it will still be monadic.
Re:Mental models around Ok-Wrapping
by efnx on Sunday April 12, 2020 @12:52AM
(#22846137)
You’re reducing two type variables down to one. The number of type variables matter. The kind of the type matters. Look at the definition of Monad for Either. You’ll see.
<T, E> can be thought of as a pair, tuple, cartesian product. Likewise you can expand it to as many values as you want.
If type C is just (T, E) then it is really just Result<C> at that point.
The first T can vary but as long as everything after that is fixed to the same type, you can have as many variables/types as you want and it will still be monadic.