mirror of
https://github.com/github/semantic.git
synced 2024-11-29 11:02:26 +03:00
Parameterized equality over Cofree.
This commit is contained in:
parent
84ea5248e3
commit
889dab1df2
@ -65,4 +65,14 @@ extension Cofree {
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Equality
|
||||
|
||||
extension Cofree {
|
||||
public static func equals(annotation annotation: (B, B) -> Bool, leaf: (A, A) -> Bool)(_ left: Cofree, _ right: Cofree) -> Bool {
|
||||
return annotation(left.extract, right.extract)
|
||||
&& Syntax.equals(ifLeaf: leaf, ifRecur: Cofree.equals(annotation: annotation, leaf: leaf))(left.unwrap, right.unwrap)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import Prelude
|
||||
|
Loading…
Reference in New Issue
Block a user