Skip to content

Commit 6f0f5f2

Browse files
Rename resolving methods
1 parent aa63210 commit 6f0f5f2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Sources/LightTableDelta/Delta.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,11 @@ public extension Delta where Element: ~Copyable {
130130
}
131131
}
132132

133-
/// Returns a reduced view of the delta, favoring the given side.
133+
/// Resolves the delta to a single element, favoring the element on the given side.
134134
///
135-
/// If an element is available on the favored side, it is returned.
136-
/// Otherwise, the element on the other side is returned.
135+
/// If the favored element is not available, the other element is returned.
137136
@inlinable
138-
consuming func unified(favoring side: Side) -> Element {
137+
consuming func resolve(favoring side: Side) -> Element {
139138
switch side {
140139
case .source:
141140
switch consume self {
@@ -152,18 +151,18 @@ public extension Delta where Element: ~Copyable {
152151
}
153152
}
154153

155-
/// Returns the combined value of the source and target element, if modified, otherwise returns the source or target value.
154+
/// Resolves the delta to a single element, coalescing the source and target elements in the transition case.
156155
@inlinable
157-
consuming func reduce<E>(
158-
combine: (consuming Element, consuming Element) throws(E) -> Element
156+
consuming func merge<E>(
157+
coalesce: (consuming Element, consuming Element) throws(E) -> Element
159158
) throws(E) -> Element {
160159
switch consume self {
161160
case .source(let source):
162161
source
163162
case .target(let target):
164163
target
165164
case .transition(let source, let target):
166-
try combine(source, target)
165+
try coalesce(source, target)
167166
}
168167
}
169168
}

0 commit comments

Comments
 (0)