1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

merge returns a Term.

This commit is contained in:
Rob Rix 2015-10-19 13:10:35 -04:00
parent 415822c1af
commit 8b5c0c87f8

View File

@ -118,8 +118,8 @@ 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)
public func merge(transform: B -> Term) -> Term {
return map(transform).iterate { Cofree((), $0) }
}
private func discardNullTerms(syntax: Syntax<Term?, A>) -> Term? {