I was thinking of this: func foo() -> Result<T> { if case .error = bar() { return .error } } func bar() -> Result<U>
-
-
Replying to @cocoaphony @timburks
`map` is still doing the same thing behind the scenes, though. That isn't cheap compared to Swift's propagation.
1 reply 0 retweets 0 likes -
Replying to @cocoaphony @timburks
`rethrows` is also easier to express this way than higher-kinded polymorphism, IMO.
1 reply 0 retweets 0 likes -
rethrows imo isn't very interesting, since the equiv value code just returns opaque T and doesn't care.
2 replies 0 retweets 0 likes -
Not sure what you mean. Something like array map would give [Result<T>] instead of giving [T] or error
1 reply 0 retweets 0 likes -
genuinely unsure which is more desirable on average, but they both seem desirable sometimes!
2 replies 0 retweets 0 likes -
though the monad approach seems like it inevitably begets a bunch of `fooM` variants of everything.
1 reply 0 retweets 0 likes -
also more importantly, truly monadic mapping over collections makes me cry... so much waste...
1 reply 0 retweets 2 likes
Mate quit hating on burritos
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.