mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Move Term and Diff to the top level.
This commit is contained in:
parent
7b517af351
commit
59b7d60349
@ -1,6 +1,10 @@
|
||||
import Doubt
|
||||
import Cocoa
|
||||
|
||||
typealias Term = Fix<JSONLeaf>
|
||||
typealias Diff = Free<JSONLeaf, Patch<JSONLeaf>>
|
||||
|
||||
|
||||
enum JSONLeaf: Equatable, CustomJSONConvertible, CustomStringConvertible {
|
||||
case Number(Double)
|
||||
case Boolean(Bool)
|
||||
@ -63,9 +67,6 @@ extension JSON {
|
||||
self.init(object: object)
|
||||
}
|
||||
|
||||
typealias Term = Fix<JSONLeaf>
|
||||
typealias Diff = Free<JSONLeaf, Patch<JSONLeaf>>
|
||||
|
||||
var term: Term {
|
||||
switch self {
|
||||
case let .Array(a):
|
||||
@ -86,7 +87,7 @@ extension JSON {
|
||||
|
||||
let arguments = BoundsCheckedArray(array: Process.arguments)
|
||||
if let a = arguments[1].flatMap(JSON.init), b = arguments[2].flatMap(JSON.init) {
|
||||
let diff = Algorithm<JSONLeaf, JSON.Diff>(a.term, b.term).evaluate()
|
||||
let diff = Algorithm<JSONLeaf, Diff>(a.term, b.term).evaluate()
|
||||
if let JSON = NSString(data: diff.JSON.serialize(), encoding: NSUTF8StringEncoding) {
|
||||
print(JSON)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user