mirror of
https://github.com/github/semantic.git
synced 2024-11-25 21:43:07 +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
|
import Prelude
|
||||||
|
Loading…
Reference in New Issue
Block a user