mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Double down on annotations.
This commit is contained in:
parent
49fb14f6a8
commit
d6a9be0794
@ -8,7 +8,7 @@ public enum Algorithm<Term: CofreeType, Result> {
|
||||
public typealias Patch = Doubt.Patch<Term>
|
||||
|
||||
/// The type of `Diff`s which `Algorithm`s produce.
|
||||
public typealias Diff = Free<Term.Leaf, Term.Annotation, Patch>
|
||||
public typealias Diff = Free<Term.Leaf, (Term.Annotation, Term.Annotation), Patch>
|
||||
|
||||
/// The injection of a value of type `Result` into an `Operation`.
|
||||
///
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// An interpreter of `Algorithm`s.
|
||||
public struct Interpreter<Term: CofreeType> {
|
||||
/// The type of diffs constructed by `Interpreter`s.
|
||||
public typealias Diff = Free<Term.Leaf, Term.Annotation, Patch<Term>>
|
||||
public typealias Diff = Free<Term.Leaf, (Term.Annotation, Term.Annotation), Patch<Term>>
|
||||
|
||||
/// Constructs an `Interpreter` parameterized by the `equal` and `comparable` tests on `Term`s, and the `cost` function for `Diff`s.
|
||||
///
|
||||
|
@ -4,7 +4,7 @@ final class DiffTests: XCTestCase {
|
||||
}
|
||||
|
||||
typealias Term = RangedTerm.Term
|
||||
typealias Diff = Free<String, Term.Annotation, Patch<Term>>
|
||||
typealias Diff = Free<String, (Term.Annotation, Term.Annotation), Patch<Term>>
|
||||
|
||||
let interpreter = Interpreter<Term>(equal: ==, comparable: const(true), cost: Diff.sum(const(1)))
|
||||
|
||||
|
@ -21,7 +21,7 @@ final class InterpreterTests: XCTestCase {
|
||||
|
||||
|
||||
private typealias Term = Cofree<String, Int>
|
||||
private typealias Diff = Free<String, Int, Patch<Term>>
|
||||
private typealias Diff = Free<String, (Int, Int), Patch<Term>>
|
||||
|
||||
private let a = Term(0, [ Term(1, .Leaf("a")), Term(2, .Leaf("b")), Term(3, .Leaf("c")) ])
|
||||
private let b = Term(0, [ Term(1, .Leaf("c")), Term(2, .Leaf("b")), Term(3, .Leaf("a")) ])
|
||||
|
@ -1,5 +1,5 @@
|
||||
struct RangedDiff {
|
||||
typealias Diff = Free<String, RangedTerm.Term.Annotation, Patch<RangedTerm.Term>>
|
||||
typealias Diff = Free<String, (RangedTerm.Term.Annotation, RangedTerm.Term.Annotation), Patch<RangedTerm.Term>>
|
||||
|
||||
let a: RangedTerm
|
||||
let b: RangedTerm
|
||||
|
Loading…
Reference in New Issue
Block a user