1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +03:00

Implement a paramorphism over TermType.

This commit is contained in:
Rob Rix 2015-10-19 11:15:44 -04:00
parent 8bd00f2414
commit d9823f144e

View File

@ -14,6 +14,10 @@ extension TermType {
return self |> ({ $0.unwrap } >>> { $0.map { $0.cata(transform) } } >>> transform)
}
public func para<Result>(transform: (Syntax<(Self, Result), LeafType>) -> Result) -> Result {
return self |> ({ $0.unwrap } >>> { $0.map { ($0, $0.para(transform)) } } >>> transform)
}
/// The count of nodes in the receiver.
///