1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Add a Replace constructor to Free when used as a Diff.

This commit is contained in:
Rob Rix 2015-10-15 11:10:16 -04:00
parent e635668719
commit 8366dc752a

View File

@ -121,6 +121,11 @@ extension Free where B: PatchConvertible, B.Element == Cofree<A, ()> {
public var inverse: Free {
return map { B(patch: $0.patch.inverse) }
}
public static func Replace(before: B.Element, _ after: B.Element) -> Free {
return .Pure(B(patch: .Replace(before, after)))
}
}