3 ms·
Yes, this article (the OP article that is) is horribly confusing and doesn't follow the ROP architecture at all. The core idea is that instead of a Func that t
by xnorswap 4y ago
Yes, this article (the OP article that is) is horribly confusing and doesn't follow the ROP architecture at all.
The core idea is that instead of a Func that takes in a Foo and returns a Bar, you can take in a Maybe<Foo> and return a Maybe<Bar>.
Then you don't need error handling in the outer composition, once everything is of the form F = Maybe<T1> -> Maybe<T2>, etc, then you can fully compose everything at the outer layer into a F = Maybe<T1> -> Maybe<Tn>.
So then you just check for Ok() at the very end and unwrap and handle any errors there.
- robertlagrant 4y agoYeah it makes loads of sense. Syntactic sugar required to make the medicine go down, of course :)