mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Implement merge
on Free
.
This commit is contained in:
parent
0e8272fa6f
commit
415822c1af
@ -118,6 +118,10 @@ public enum Free<A, B>: CustomDebugStringConvertible, SyntaxConvertible {
|
||||
extension Free where B: PatchType, B.Element == Cofree<A, ()> {
|
||||
public typealias Term = B.Element
|
||||
|
||||
public func merge(transform: B -> Term) -> Free {
|
||||
return flatMap(transform >>> Free.init)
|
||||
}
|
||||
|
||||
private func discardNullTerms(syntax: Syntax<Term?, A>) -> Term? {
|
||||
switch syntax {
|
||||
case let .Leaf(a):
|
||||
|
Loading…
Reference in New Issue
Block a user