1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 09:55:52 +03:00
semantic/prototype/Doubt/TermType.swift
2015-10-15 09:18:55 -04:00

19 lines
373 B
Swift

/// The type of terms.
public protocol TermType {
typealias LeafType
var unwrap: Syntax<Self, LeafType> { get }
}
extension Cofree: TermType {}
// MARK: - Equality
extension TermType {
public static func equals(leaf: (LeafType, LeafType) -> Bool)(_ a: Self, _ b: Self) -> Bool {
return Syntax.equals(ifLeaf: leaf, ifRecur: equals(leaf))(a.unwrap, b.unwrap)
}
}