mirror of
https://github.com/github/semantic.git
synced 2024-12-27 08:54:14 +03:00
Define a reiterate
function.
This commit is contained in:
parent
d0aeedeb52
commit
4195edc469
@ -126,6 +126,11 @@ public func hylo<A, B, Leaf>(down: Syntax<B, Leaf> -> B, _ up: A -> Syntax<A, Le
|
||||
return up >>> { $0.map(hylo(down, up)) } >>> down
|
||||
}
|
||||
|
||||
public func reiterate<A, B, Leaf, Annotation>(down: (Annotation, Syntax<B, Leaf>) -> B, _ up: A -> (Annotation, Syntax<A, Leaf>)) -> A -> B {
|
||||
return up >>> { ($0, $1.map(reiterate(down, up))) } >>> down
|
||||
}
|
||||
|
||||
|
||||
|
||||
extension Free where Value: PatchType, Value.Element == Cofree<Leaf, ()> {
|
||||
public typealias Term = Value.Element
|
||||
|
Loading…
Reference in New Issue
Block a user