1
1
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:
Rob Rix 2015-10-14 10:52:27 -04:00
parent 84ea5248e3
commit 889dab1df2

View File

@ -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