mirror of
https://github.com/github/semantic.git
synced 2024-11-29 11:02:26 +03:00
Add a typealias representing the type of patches.
This commit is contained in:
parent
c97b0ec9f5
commit
ef5720ad17
@ -7,8 +7,11 @@ public enum Algorithm<A, B> {
|
||||
/// The type of `Term`s over which `Algorithm`s operate.
|
||||
public typealias Term = Fix<A>
|
||||
|
||||
/// The type of `Patch`es produced by `Algorithm`s.
|
||||
public typealias Patch = Doubt.Patch<A>
|
||||
|
||||
/// The type of `Diff`s which `Algorithm`s produce.
|
||||
public typealias Diff = Free<A, Patch<A>>
|
||||
public typealias Diff = Free<A, Patch>
|
||||
|
||||
/// The injection of a value of type `B` into an `Operation`.
|
||||
///
|
||||
@ -104,7 +107,7 @@ extension Free: FreeConvertible {
|
||||
public var free: Free { return self }
|
||||
}
|
||||
|
||||
extension Algorithm where B: FreeConvertible, B.RollType == A, B.PureType == Patch<A> {
|
||||
extension Algorithm where B: FreeConvertible, B.RollType == A, B.PureType == Algorithm<A, B>.Patch {
|
||||
/// `Algorithm<A, Diff>`s can be constructed from a pair of `Term`s using `ByKey` when `Keyed`, `ByIndex` when `Indexed`, and `Recursive` otherwise.
|
||||
public init(_ a: Term, _ b: Term) {
|
||||
switch (a.out, b.out) {
|
||||
@ -122,7 +125,7 @@ extension Algorithm where B: FreeConvertible, B.RollType == A, B.PureType == Pat
|
||||
}
|
||||
}
|
||||
|
||||
extension Algorithm where A: Equatable, B: FreeConvertible, B.RollType == A, B.PureType == Patch<A> {
|
||||
extension Algorithm where A: Equatable, B: FreeConvertible, B.RollType == A, B.PureType == Algorithm<A, B>.Patch {
|
||||
public func evaluate() -> B {
|
||||
return evaluate(==)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user