File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public struct Fork<LeftOutput, RightOutput> {
3939 /// - leftOutput: An `async` closure that uses `LeftInput` to return `LeftOutput`
4040 /// - rightOutput: An `async` closure that uses `RightInput` to return `RightOutput`
4141 public init < Value, LeftInput, RightInput> (
42- value: @escaping ( ) -> Value ,
42+ value: @escaping ( ) async throws -> Value ,
4343 leftInputMap: @escaping ( Value ) throws -> LeftInput ,
4444 rightInputMap: @escaping ( Value ) throws -> RightInput ,
4545 leftOutput: @escaping ( LeftInput ) async throws -> LeftOutput ,
@@ -91,7 +91,7 @@ public struct Fork<LeftOutput, RightOutput> {
9191 /// - leftOutput: An `async` closure that uses `LeftInput` to return `LeftOutput`
9292 /// - rightOutput: An `async` closure that uses `RightInput` to return `RightOutput`
9393 public init < Value> (
94- value: @escaping ( ) -> Value ,
94+ value: @escaping ( ) async throws -> Value ,
9595 leftOutput: @escaping ( Value ) async throws -> LeftOutput ,
9696 rightOutput: @escaping ( Value ) async throws -> RightOutput
9797 ) {
Original file line number Diff line number Diff line change @@ -58,14 +58,12 @@ public struct ForkedArray<Value, Output> {
5858
5959 /// Asynchronously resolve the forked array
6060 public func output( ) async throws -> [ Output ] {
61- try await fork. merged (
62- using: { leftForkType, rightForkType in
63- async let leftOutput = try await ForkedArray . output ( for: leftForkType, isIncluded: filter, transform: map)
64- async let rightOutput = try await ForkedArray . output ( for: rightForkType, isIncluded: filter, transform: map)
65-
66- return try await leftOutput + rightOutput
67- }
68- )
61+ try await fork. merged { leftForkType, rightForkType in
62+ async let leftOutput = try ForkedArray . output ( for: leftForkType, isIncluded: filter, transform: map)
63+ async let rightOutput = try ForkedArray . output ( for: rightForkType, isIncluded: filter, transform: map)
64+
65+ return try await leftOutput + rightOutput
66+ }
6967 }
7068}
7169
You can’t perform that action at this time.
0 commit comments