Avatar
The throwing overload of flatMap should be removed. It is composable from flatMap and init(catching:) , and it is generally frowned upon to overload just on whether something is throwing or not.
6:44 AM
↑と組み合わせると a.flatMap { Result { try foo() }.mapError { $0 as Error } } となって辛そう。
6:45 AM
あ、逆か (edited)
6:45 AM
a.flatMap { Result { try foo() }.mapError { $0 as! FooError } }